Host file replaced

29 views
Skip to first unread message

Aditya Gupta

unread,
Oct 4, 2016, 6:24:16 PM10/4/16
to Puppet Developers
Hello All,
I am using host resources in my puppet class to manage hosts file of the client.

I am facing one issue where if I have already connected client to the puppet server where hosts file have its own entries as well as entries defined by puppet server .

But whenever I replaced my hosts file from some other server then in next puppet run my old entries removed from the hosts file and I can only see entries managed by puppet.

Please help me in this issue.

Thanks,
Aditya

Craig Dunn

unread,
Oct 5, 2016, 3:14:38 AM10/5/16
to puppe...@googlegroups.com
FYI in future this type of question is probably more suited to puppet-users than puppet-dev.

It sounds like resource purging, meaning that Puppet will purge any resources found that are not under Puppet control.  You don't mention if you use a Forge module to manage hosts, or something home grown - if you're using something like https://forge.puppet.com/ghoneycutt/hosts then you'll need to set (or unset) the "purge_hosts" option.  Otherwise, you might have something like this declared....

resources { 'hosts': purge => true }

Either way, it should be easy enough to change the behaviour but without knowing what module you are using I can't really tell you exactly how.

Craig 

--
Enviatics     |      Automation and Configuration Management
Puppet Labs Service Delivery Partner & Certified Consultant

Aditya Gupta

unread,
Oct 5, 2016, 7:56:45 AM10/5/16
to Puppet Developers
Thanks for the answer.

I am using standard puppet resource type:


and i can not see support of purge parameter in it.

Rob Nelson

unread,
Oct 5, 2016, 8:39:30 AM10/5/16
to puppe...@googlegroups.com
You're specifically looking for a resource called `resources` with the title `host`, as shown at http://www.puppetcookbook.com/posts/remove-all-unmanaged-host-entries.html. More info at https://docs.puppet.com/puppet/latest/reference/type.html#resources

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/0b57afa6-4d5f-4a62-97fc-6c7f6b5a4bf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages