If you're managing all of the entries in /etc hosts with puppet, you
can use the resources resource to purge entries that do not have
resources declared in the catalog.
resources { host: purge => true }
WARNING this will delete entries you have not declared in the catalog.
Test things out with --noop
-Jeff
On Jan 28, 2011, at 1:03 PM, bowlby <[email protected]> wrote:
> Sorry for reviving this old post but I'm having trouble with the above
> setup.
>
> Everytime one of my slaves changes it's IP the hostfile on the ssh-
> gateway gets updated. So for, so good. But the update just adds an
> entry to the hosts-file, thereby leaving the old entry intact. So I
> end up with:
>
> 10.72.1.21 server1
> 10.72.1.45 server1
> 10.72.1.90 server1
> etc.
>
> Is there an easy solution to this?
>
> Thanks!
>
>
> On Jan 3, 9:38 am, Bram Enning <[email protected]> wrote:
>> Thanks! Stefans suggestion seemed elegant and productive, and proved to be
>> so.
>>
>> On Sat, Jan 1, 2011 at 6:48 PM, Stefan Schulte
>>
>> <[email protected]> wrote:
>>> On Sat, Jan 01, 2011 at 12:53:11AM -0800, bowlby wrote:
>>>> Hi,
>>
>>>> I'm figuring out a way to build a ssh-gateway. For that to work I want
>>>> access to the internal ipaddresses that are used by my slaves (which
>>>> get assigned by dhcp and thus are not predictable). This way I can
>>>> change the host-file on my ssh-gateway so that hostnames point to the
>>>> right nodes.
>>
>>>> So I want something like:
>>
>>>> SSH-gateway-hostfile:
>>>> 192.168.1.12 hostname1
>>>> 192.168.1.67 hostname2
>>
>>>> Is there a way to access facts on from nodes other than the node
>>>> you're working on?
>>
>>> Have a look at exported resources [1]. All your nodes that need an entry
>>> can export a resource
>>
>>> @@host { $fqdn:
>>> ip => $ipaddress,
>>> host_aliases => $hostname,
>>> ensure => present,
>>> target => '/ssh_gateway_hostfile',
>>> tag => 'ssh-gateway',
>>> }
>>
>>> And on your gateway you'll do
>>
>>> Host <<| tag == 'ssh-gateway' |>>
>>
>>> You have to enable stored configuration for that [2]. Then you run
>>> puppet agent on all your slave nodes and after that on your ssh gateway.
>>
>>> [1]http://projects.puppetlabs.com/projects/1/wiki/Exported_Resources
>>> [2]http://projects.puppetlabs.com/projects/1/wiki/Using_Stored_Configura...
>>
>>> -Stefan
>>
>>> --
>>> 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
>>> athttp://groups.google.com/group/puppet-users?hl=en.
>>
>>
>
> --
> 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.
>
--
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.