PE Puppet Console and manage multiple node user accounts

211 views Asked by At

I'm new to puppet and using Puppet Enterprise with the module from puppet for accounts. https://forge.puppet.com/puppetlabs/accounts

I'd like to be able to manage the user account details from the PE console for multiple users.

The best I can seem to get to is managing them within

/etc/puppetlabs/code/environments/production/manifests/site.pp

Which contains:

node default {

accounts::user { 'jeff':
  comment  => 'Jeff McCune',
  groups   => [
    'wheel',
  ],
  locked   => true,
  sshkeys  => [
    'ssh-rsa AAAA...',
    'ssh-dss AAAA...',
  ],
  password => '!!',
  ensure => 'present',
}

accounts::user { 'dave':
  comment  => 'Dave Smith',
  groups   => [
    'wheel',
  ],
  locked   => true,
  sshkeys  => [
    'ssh-rsa AAAA...',
    'ssh-dss AAAA...',
  ],
  password => '!!',
  ensure => 'present',
}

}

I'd ideally I'd like to be able to manage them per PE classification within the console. So each users details can be parameters I enter in the PE console - the number of users would vary, but just need the principle to able to add more than one.

I've tried adding into a manifest but struggled with declaring more than one account. I did that by:

/etc/puppetlabs/code/environments/production/modules/my_app/manifests/init.pp

which contained:

class my_app (

$username => '',
$usercomment => '',
$sshkey ='',

){

accounts::user { $username:
  comment  => $usercomment,
  groups   => [
    'sudonopw',
  ],
  locked   => false,
  sshkeys  => [
   $sshkey,
  ],
  password => '!!',
  ensure => present, 

}

}

This allowed me to apply this class to any variation of my node classification and allow me to manage those parameters in the PE console. However I couldn't add more than one account to each node, as the class had been declared.

Can anyone give me some pointers.

Thanks

0

There are 0 answers