Created
April 23, 2013 16:01
-
-
Save anonymous/5444911 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class accounts::users ( $accounts, $groups,) | |
{ | |
create_resources(group, $groups) | |
create_resources('create_user', $accounts) | |
} | |
define create_user ($uid, $gid, $ensure = present, $home = "/home/$name", $shell = "/bin/bash", $managehome = true ) | |
{ | |
user { $name: | |
uid => $uid, | |
gid => $gid, | |
managehome => $managehome, | |
} | |
exec { "puppet-cleanup-users": | |
refreshonly => true, | |
command => "/usr/local/bin/post-scripts/postscript.puppet-cleanup-users $name", | |
subscribe => User[$name], | |
require => File['/usr/local/bin/post-scripts/postscript.puppet-cleanup-users'] | |
} | |
file { '/usr/local/bin/post-scripts/postscript.puppet-cleanup-users': | |
ensure => present, | |
owner => 'root', | |
group => 'root', | |
mode => '0755', | |
source => "puppet:///modules/accounts/postscript.puppet-cleanup-users" | |
} | |
} | |
class accounts { | |
include accounts::users | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
accounts::users::accounts: | |
sysadmin: | |
ensure: present | |
home: /home/sysadmin | |
managehome: "true" | |
shell: /bin/bash | |
uid: 7001 | |
gid: sysadmin | |
accounts::users::groups: | |
sysadmin: | |
ensure: present | |
gid: 4000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# puppet agent --test --server pmaster --environment env1 | |
Info: Retrieving plugin | |
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb | |
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb | |
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb | |
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb | |
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Exec[puppet-cleanup-users] is already declared in file /etc/puppet/environments/env1/modules/accounts/manifests/init.pp at line 34; cannot redeclare on node node20 | |
Warning: Not using cache on failed catalog | |
Error: Could not retrieve catalog; skipping run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment