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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to