Foreman hosts file update

Problem: I am trying to manage the hosts file through the Foreman UI. I installed the https://forge.puppet.com/glorpen/hosts puppet module, imported into Foreman successfully. All I am trying to do is edit the hosts file on certain machines but I don’t know how to write the syntax for the “over-ride/default value”. I assume I should be using an array, but I’m not sure how this exactly should be written out. I have had several errors (all different) and it’s all in my syntax. Can someone give me an example of what should go in there and how you figured it out? (sorry, I know I’m a newbie when it comes to this)

Expected outcome:

Foreman and Proxy versions:
1.20.2

Foreman and Proxy plugin versions:

Other relevant data:
It works fine when I do not click the over-ride (however, I want to edit the hosts files on different hosts)

logs

Figured this out and fixed it now.

Care to share how for the benefit of future googlers?

Sure thing! (Sorry about that. I assumed everyone already knew this). Here is the format that I used that worked:

I used “array” and plugged this into the var section (this is 2 servers)
[{“ip”:“1.1.1.1”,“aliases”:“server-1.com server-1”},{“ip”:“2.2.2.2”,“aliases”:“server-2.com server-2”}]

So when the puppet agent runs against anything, the hosts file would like this:
1.1.1.1 server-1.com server-1
2.2.2.2 server-2.com server-2

1 Like