I''m probably missing something really simple here, but I can''t
get the following to work:
node ''puppet-slave.test.net'' {
  include users::accounts
  User <| title="account" |>
}
Any suggestions welcomed :)
Modules:
modules/users/manifests/virtual.pp 
class users::virtual {
  define account ( $uid, 
                   $gid = '''', 
                   $home = '''',
                   $groups = '''',
                   $realName = '''',
                   $pass = '''',
                   $shell = ''/bin/bash'',
                   $sshkey = '''') {
    $userGroup = $gid ? {
                   ''''      => $uid,
                   default => $gid,
                 }
    $homeDir = $home ? {
                 ''''      => "/home/${title}",
                 default => $home,
               }
    $comment = $realName ? {
                 ''''      => $title,
                 default => $realName,
               }
  #  Create User Group
    group { $title:
      ensure => ''present'',
      gid    => $userGroup,
    }
  #  Create User Account
    user { $title:
      ensure     => ''present'',
      uid        => $uid,
      gid        => $userGroup,
      shell      => $shell,
      home       => $homeDir,
      comment    => $comment,
      password   => $pass,
      groups     => $groups,
      managehome => ''true'',
    }
    #  Add SSH Key if defined.
    if ( $sshkey != '''' ) {
      ssh_authorized_key { $title:
        ensure  => ''present'',
        type    => ''ssh-rsa'',
        key     => "${sshkey}",
        user    => "${title}",
        require => User[ "${title}" ],
        name    => "${title}",
      }
    }
  }
}
modules/users/manifests/accounts.pp 
class users::accounts {
  include users::virtual
  # Brett Maton
  @users::virtual::account { 
    ''account'':
      uid      => ''1001'',
      realName => ''account'',
      groups   => ''wheel'',
      sshkey   => [ Key Data ];
    ''account2'':
      uid      => ''1002'',
      realName => ''Second Account'',
      groups   => ''wheel'',
      sshkey   => [ Key Data ]
  }
}
-- 
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.
puppet-users@henk.geekmail.org
2012-Jun-29  15:07 UTC
Re: [Puppet Users] virtual resources & spaceship syntax
Hi, On Fri, 29 Jun 2012 15:36:35 +0100 Brett Maton <brett.maton@googlemail.com> wrote:> I''m probably missing something really simple here, but I can''t get > the following to work: > > node ''puppet-slave.test.net'' { > include users::accounts > User <| title="account" |> > }It’s supposed to be a comparison, not an assignment, so title == ''account'' Best regards Hendrik Jäger
Thanks for looking Henk, I think my email client replaced == with =, it is using the comparison op in the actual code.... On Friday, 29 June 2012 16:07:55 UTC+1, (unknown) wrote:> > Hi, > > On Fri, 29 Jun 2012 15:36:35 +0100 > Brett Maton <brett.maton@googlemail.com> wrote: > > > I''m probably missing something really simple here, but I can''t get > > the following to work: > > > > node ''puppet-slave.test.net'' { > > include users::accounts > > User <| title="account" |> > > } > > It’s supposed to be a comparison, not an assignment, so > title == ''account'' > > Best regards > > Hendrik Jäger >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/4k8Mo2ehCUQJ. 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.
Kristof Willaert
2012-Jun-29  15:54 UTC
Re: [Puppet Users] virtual resources & spaceship syntax
Hi, [snip]> node ''puppet-slave.test.net'' { >> > include users::accounts >> > User <| title="account" |> >> > } > >Your virtual resource is not a "user", but a define called "users::virtual::account". So you need to realize it using: Users::Virtual::Account <| title == "account" |> Kind regards, kristof -- 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.
:D I knew it would be something simple, thanks Kristof that''s working now. Brett On 29 Jun 2012, at 16:54, Kristof Willaert wrote:> Hi, > > [snip] > > > node ''puppet-slave.test.net'' { > > include users::accounts > > User <| title="account" |> > > } > > Your virtual resource is not a "user", but a define called "users::virtual::account". > So you need to realize it using: > > Users::Virtual::Account <| title == "account" |> > > Kind regards, > > kristof > > -- > 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.-- 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.