Using Virtual Resource in custom resource type

23 views
Skip to first unread message

Douglas Brancaglion

unread,
Aug 21, 2012, 2:56:46 PM8/21/12
to puppet...@gmail.com, puppet...@googlegroups.com
Hi!

I am facing difficulties in using the virtual resource types in resorce custom, I have a definition of user creation as shown below:

define add_user ( $email, $uid, $key, $groups ) {

            $username = $title

            user { $username:
                    comment    => "$email",
                    groups     => $groups,
                    managehome => true,
                    home       => "/home/$username",
                    shell      => "/bin/bash",
                    uid        => $uid
            }


            file { "/home/$username/":
                    ensure  => directory,
                    owner   => $username,
                    group   => $username,
                    mode    => 700,
                    require => [ user[$username] ]
            }

            file { "/home/$username/.ssh":
                    ensure  => directory,
                    owner   => $username,
                    group   => $username,
                    mode    => 700,
                    require => file["/home/$username/"]
            }


            # now make sure that the ssh key authorized files is around
            file { "/home/$username/.ssh/authorized_keys":
                    ensure  => present,
                    owner   => $username,
                    group   => $username,
                    mode    => 600,
                    require => file["/home/$username/"]
            }

            ssh_authorized_key{ "${username}":
                    ensure  => present,
                    type    => "ssh-rsa",
                    user    => $username,
                    key     => $key,

            }

    }

And in my users manifests I declare this way:
        

        @add_user { test:
                 email   => "user test",
                 uid     => 1040,
                 groups  => apache,
key => "AAAAB3NzaC1yc2EAAAADAQfTRr6mUam1rIiwWhseaRP9M83L2NXFBMix4d7q1xkO/bMqCvvRPjzVzQNGhEJFn8Pjz2pr+QcK2c2yqceSTpbVoxM8Gg5/dXwKv+ct4qKjLVtSty8s/VW8g+kI3N5R9Xv1SG7exJdutKfEnoCGY4lXjrU11fvCZq5Zrc5",
        }

and in my node i declare this way:

import "custom_resource"
import "users_manifests"

node "server01.domain" {

 


--
Douglas Brancaglion
Security Analist

jcbollinger

unread,
Aug 27, 2012, 2:38:21 PM8/27/12
to puppet...@googlegroups.com, puppet...@gmail.com


On Tuesday, August 21, 2012 1:56:46 PM UTC-5, Douglas Brancaglion wrote:
Hi!

I am facing difficulties in using the virtual resource types in resorce custom [...]

What exactly is the nature of the problem? It looks like maybe your post was truncated.


John

Reply all
Reply to author
Forward
0 new messages