Hi Gonzalo,
First of all you don't need puppetdb to use exported resources. A simple
mysql database will do it, even sqlite works, not recommended though.
Specifically what you need is "stored configs" configured in your puppet
master. The problem with exported resources is that sometimes they can be
slow... depends obviously on the amount of nodes, resources, etc.
Regarding your question if it can be done in a different way... I would
definitely use DNS if possible... if not exported resources if very easy to
implement. The function idea I don't think is "that" bad... I would prefer
to query a database rather than parsing files.
Another way I can think about is to use a custom ENC to export those
parameter. The ENC would take the information from some type of database
that you have to update as well. That would be definitely faster and a more
elegant solution
Depending on the size of your infrastructure and performance I would go for
exported resources and if that is too slow I would consider some of the
other options
Cheers
Juan
On Monday, October 14, 2013 7:19:56 AM UTC+1, Gonzalo wrote:
>
> 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 [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.