I am currently in the process of cleaning up some of my puppet config files
in particular some user and some virtual templates:
I get the following error:
*"err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Duplicate definition: Group[testgroup] is already defined in file
/etc/puppet/manifests/templates/accounts.pp at line 22; cannot redefine at
/etc/puppet/manifests/templates/accounts.pp:22 on node
puppettest.test.internal"*
If I remove
My files:
*users.pp*
*class users *
*{*
* @accounts::virtual
*
* { *
* 'test.user':*
* realname => 'testusername',*
* pass => 'testpass',*
* gid => "testgroup",*
* }
*
* *
* @accounts::virtual *
* { *
* 'test.user2':*
* realname => 'testuser2name',*
* pass => 'testpass',*
* gid => "testgroup2",*
* }
*
* *
* @accounts::virtual *
* { *
* 'test.user3':*
* realname => 'testuser3name',*
* pass => 'testpass',*
* gid => "testgroup",*
* }*
*accounts.pp*
*
*
*define accounts::virtual ($realname,$pass,$gid,$sshkey="") *
*{ *
* user *
* { *
* $title:*
* ensure => present,*
* comment => "${realname} ${gid} User",*
* gid => $title,*
* shell => '/bin/bash',*
* require => Group[$gid],*
* home => "/home/${title}",*
* managehome => true,*
* password => $pass,*
* }*
* *
* group *
* { *
* $gid:*
* ensure => present,*
* }*
* *
* file *
* { *
* "/home/${title}":*
* ensure => directory,*
* owner => $title,*
* group => $gid,*
* mode => 0700,*
* require => [ User[$title], Group[$gid] ],*
* }*
* *
* # If we have an SSH key present then insert it onto the user*
* if ( $sshkey != "" ) *
* {*
* ssh_authorized_key *
* { *
* $title:*
* ensure => "present",*
* type => "ssh-rsa",*
* key => "$sshkey",*
* user => "$title",*
* require => User["$title"],*
* name => "$title",*
* }*
* }*
* *
* # If there is no key specified, make sure this value is blank *
* if ( $sshkey == "" ) *
* {*
* ssh_authorized_key *
* { *
* $title:*
* ensure => "absent",*
* user => "$title",*
* require => User["$title"],*
* }*
* }*
*}*
then inside *site.pp*
*
*
*include users*
*realize (Accounts::Virtual['test.user','test.user2','test.user3'])*
*
*
If I remove test.user3 it all works fine, so this is something related to
the group being declared or what puppet thinks is declared twice because of
the way I have created a virtual class. Is there any obvious solutions to
this besides absolutely declaring each user individually?
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.