Skip to content

Instantly share code, notes, and snippets.

@b4ldr
Created August 1, 2014 14:48
Show Gist options
  • Save b4ldr/dc05aa5421194159c2e4 to your computer and use it in GitHub Desktop.
Save b4ldr/dc05aa5421194159c2e4 to your computer and use it in GitHub Desktop.
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: User[peadmin] is already declared in file /etc/puppetlabs/puppet/environment/nsd_concat/modules/users/manifests/adduser.pp:46; cannot redeclare at /opt/puppet/share/puppet/modules/pe_accounts/manifests/user.pp:90 on node master1.lax.dns.icann.org
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
define users::adduser (
$username = $name,
$comment = 'No Comment',
$uid = undef,
$managehome = false,
$groups = ['sudo', 'quaggavty' ],
$shell = '/bin/bash',
$password = '!',
$ssh_type = 'ssh-rsa',
$ssh_comment = undef,
$ssh_key = undef
) {
if ! defined( User[$username] ){
user {
$username:
name => $username,
comment => $comment,
uid => $uid,
password => $password,
managehome => $managehome,
groups => $groups,
shell => $shell,
require => [Group[$groups]],
home => "/home/$username";
}
}
}
class users (
$userlist,
$grouplist = [],
){
require pe_accounts
group {
$grouplist:
ensure => present;
}
create_resources(users::adduser, $userlist )
#make sure the file is empty we dont want users logging in as root
file {
'/root/.ssh/authorized_keys':
owner => 'root',
content => '',
mode => '0600',
require => Ssh_authorized_key[keys($userlist)];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment