On Wed, Nov 16, 2011 at 1:19 AM, Karen Loomans <[email protected]> wrote:
> Hi,
>
> I have a module to manage /etc/hosts that works fine for RHEL, but not on
> Solaris.  Basically I've defined all our hosts as virtual host resources,
> and grouped them various ways by tagging them.  These are then realized
> based on the tags for each node as appropriate.  Hosts can have multiple
> tags and not have any issues with duplicate resource declarations as they
> are virtual.  Any unmanaged host is then purged from the hosts file.
>
> The problem for Solaris occurs with the localhost entries:
>
> ::1     localhost
> 127.0.0.1       localhost
>
> You can't define host resources with the same name.
>
> I would prefer to keep using the host resource if I can as it all works
> beautifully on our RHEL servers (the localhost names are unique).  I thought
> I might be able to:
>    1. Template the beginning of the hosts file to include the localhost
> entries appropriate to the os, writing out to /tmp/hosts_head.
>    2. Generate another file in /tmp/hosts_body that contains the remainder
> of the hosts using my current method of realizing the virtual hosts.
>    3. Concatenate the two.
>
> However, when I redirect the target for all the host resources to
> /tmp/hosts_body, it rips out the contents in the real /etc/inet/hosts:
>    notice: /Stage[after]/Hosts::Virtual/Host[george]/target: target changed
> '/etc/inet/hosts' to '/tmp/hosts_body'
>
> Has anyone solved this problem on Solaris or can offer some suggestions?

Would this work for your usage:

host { 'ip6-localhost':
  ip           => '::1',
  host_aliases => 'localhost',
}
host { 'localhost':
  ip => '127.0.0.1'
}

Thanks,

Nan

-- 
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.

Reply via email to