Re: [Puppet Users] Virtual Resources with variables

Walter Heck
Tue, 21 Aug 2012 19:19:45 -0000

Realize add_user instead of user..

Sent from my galaxy tab
On Aug 22, 2012 3:01 AM, "Douglas Brancaglion"
<douglas.reader@gmail.com>
wrote:

> realize > }
 On Aug 22, 2012 3:01 AM, "Douglas Brancaglion"
<douglas.reader@gmail.com>
wrote:

> 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" {
>
> realize User[test]
> }
>
> but i receive that error message:
> err: Could not retrieve catalog from remote server: Error 400 on SERVER:
> Failed to realize virtual resources User[dbrancaglion]
>
> Sorry duplicate message, my browser crashed!!
>
> Can help me?
>
> Tks!
> --
> Douglas Brancaglion
> Security Analist
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>