Question

The types host and augeas can only set certain values in /etc/hosts. facter does not support hosts query.

Now I'm considering

1)writing a ruby function, using Resolv library

2)writing a ruby function, and actually read /etc/hosts file

Any better ideas?

Was it helpful?

Solution

If you really want the master to know and work with the contents of the agent's hosts file, you will have indeed no choice but to write a custom fact to do so. Facter 2.x will be required to retrieve an array/hash structure. The Resolv library would be a very odd choice. You would be better off parsing the file yourself.

Technically, Puppet comes with code to parse the hosts file, but harnessing that would likely be much harder than rolling your own.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top