On Tuesday, May 13, 2014 10:16:16 PM UTC-5, Toky wrote:
>
> Hello all,
>
> I have the following code I use to populate /etc/hosts :
>
> # This module will gather hostnames and IPs in order to populate hosts 
> files
>
> class hosts {
>
>   host  { 'localhost.localdomain':
>   ensure        =>  present, 
>   ip            =>  '127.0.0.1',
>   host_aliases  =>  [ 'localhost' ],
>   }
>
>   @@host  { $fqdn:
>   ensure        =>  present,
>   ip            =>  $ipaddress_eth0,
>   host_aliases  =>  [ $hostname, $tag_name ],
>
>   }
>
> # Here we ensure we are capturing all exported nodes
>
> Host <<| |>>
> }
>
> I would like to send the exported resources to another file too 
> (/usr/local/etc/ec2-hosts)
>
> How can I get the exported resources above (hostname and ip) in to such 
> file?
>

That doesn't make any sense.  I mean, I understand what you are trying to 
accomplish, but Host resources simply don't fit into it.  You are thinking 
of Hosts as if they represented a line of text with a certain structure, 
but that's altogether the wrong view.

A Host resource represents a hostname-to-net-address mapping known by the 
target node.  The target either knows this mapping or doesn't; it doesn't 
make sense to ask for the target to know it in two places.  Moreover, the 
local manifestation of "knowing" a Host mapping is not part of the mapping 
itself.  On many types of systems it will manifest as an entry in 
/etc/hosts, but there are other alternatives (the docs call out OS X 
systems as ones where the manifestation is different).

 

> A sym-link from /etc/hosts will not work for what I need. 
>

You need a separate set of resources to manage your other file.  Have a 
look at the Concat module -- it may get you where you need to go.


John

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/ae11d5f7-b248-446d-b9d1-ff79135e0711%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to