Foreman hosts file update

Problem: I am trying to manage the hosts file through the Foreman UI. I installed the 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:

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)


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”:“”,“aliases”:“ server-1”},{“ip”:“”,“aliases”:“ server-2”}]

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

1 Like