I guess your options are a template or augeas. Please fill in an issue in redmine.
cheers, Ohad On Thu, Jan 14, 2010 at 8:11 PM, Peter <[email protected]> wrote: > Its all a bit weird. > > an empty string does what I want but it then changes the host file and > spits out its changing absent to absent. > > a space gives > Jan 14 03:48:04 buildsun4u puppetd[12213]: [ID 702911 daemon.error] > Could not run Puppet configuration client: Parameter alias failed: > Aliases cannot include whitespace > looks like it bails after that > > Also if there are two nodes with the same canonical name puppet will > make the ips the same but does not delete the second entry so you are > left with 2 lines with the same IP address. > > When you update the alias it only changes one of the lines. > > I have purging enabled with > resources { "hosts purge": > > name => host, > > purge => true, > > } > > > What I'm trying to achieve is if I declare a host it is set exactly > like that and any other entries are removed from the host file > including any unspecified nodes, any aliases that are not specified (I > can't get this to work if there are no aliases to specify) and any > duplicates (they are not removed or there aliases amended). > > So if I have the following resources > resources { "hosts purge": > > name => host, > > purge => true, > > } > > host { "hosts localhost" : > > ip => "127.0.0.1", > > name => "localhost", > > ensure => present, > > } > > if $hostname == "buildserver" { > > host { "hosts buildserver" : > > ip => "192.168.1.1", > > name => "buildserver", > > ensure => present, > > alias => '', > > } > > } > > if $hostname == "buildsun4u" { > > host { "hosts buildsun4u" : > > ip => "192.168.1.2", > > name => "buildsun4u", > > ensure => present, > > alias => '', > > } > > } > > host { "hosts directory" : > > ip => "192.168.1.3", > > name => "directory.mydomain", > > ensure => present, > > } > > > If the host file starts out > > # Internet host table > > # > > ::1 localhost > > 192.168.1.3 directory.mydomain > 127.0.0.1 localhost > > 192.168.1.1 buildserver myalias > > 192.168.1.99 buildserver > 192.168.1.100 splot > > > I would like to get > > # Internet host table > # > ::1 localhost > 192.168.1.3 directory.mydomain > 127.0.0.1 localhost > 192.168.1.1 buildserver > > instead of > > # Internet host table > # > ::1 localhost > 192.168.1.3 directory.mydomain > 127.0.0.1 localhost > 192.168.1.1 buildserver myalias > 192.168.1.1 buildserver > > Thanks > > Peter > > On Jan 14, 2:54 am, Ohad Levy <[email protected]> wrote: > > I guess I was wrong, looking at the code I dont think that you can remove > an > > alias, just replace it to something else. > > > > funny, if you put the word absent as an alias, puppet think there is no > > alias. > > > > sounds like a bug to me as the absent key word is translated into absent > > alias value. > > > > On Thu, Jan 14, 2010 at 4:15 PM, Ohad Levy <[email protected]> wrote: > > > ensure => absent > > > > > On Thu, Jan 14, 2010 at 3:11 PM, Peter <[email protected]> wrote: > > > > >> Hi, > > > > >> I'm trying to create a host entry and want puppet to remove the alias > > >> if is exists for that host in the host file. > > > > >> If alias is not set aliases are left as they are for that host. > > > > >> If alias is set to undef aliases are left as they are. > > > > >> If alias is set to '' is constantly changes the host file on each run. > > > > >> Is ther a way of achieving this? > > > > >> Thanks > > > > >> Peter > > > > >> -- > > >> You received this message because you are subscribed to the Google > Groups > > >> "Puppet Users" group. > > >> To post to this group, send email to [email protected]. > > >> To unsubscribe from this group, send email to > > >> [email protected]<puppet-users%[email protected]> > <puppet-users%[email protected]<puppet-users%[email protected]> > > > > >> . > > >> For more options, visit this group at > > >>http://groups.google.com/group/puppet-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<puppet-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > > >--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
