Hi All,

I am using Puppet 3.2.4 and I'd like Puppet to manage /etc/hosts for me and
add "neighbouring hosts" only to /etc/hosts. These hosts are determined to
be neighbours based on where they are (city/country).

For example ($::city and $::country are custom facts):

@@host { $::fqdn:
   ip           => $::ipaddress,
   host_aliases => [ $::hostname ],
   tag          => [ $::city, $::country ],
}

Host <<| tag == $::city and tag == $::country |>>

As I have never used exported resources before, I gave this a try and
realised there is more to them than the above config. It looks like I need
to install PuppetDB to make it work, which looks challenging given that the
puppet master is on SLES 11.

Apart from using exported resources, does anyone have any ideas on how to
achieve this?

One nasty way of doing it was to create a Puppet function that looks at
/var/lib/puppet/yaml/node/*.yaml and matches filenames based on a regex
passed in as an argument, then parses each yaml file and returns
'ipaddress', 'fqdn' and 'hostname' from them to update /etc/hosts, but it's
way too hacky for my liking.

- Gonzalo

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to