Changing Host Settings via CM (Ansible)

Hello,

Is there any way it’s currently possible to change host settings via Ansible?
An example of this: changing the IPv6 prefix for an already provisioned system.
Although I could make a script that duplicates the network parameters, it would be nice to be able to access the configured host parameters and apply these after the provisioning.

My use-case

  1. we have a bunch of devices that I’d like to pre-provision as Smart Proxies, however, it’s not always clear in which network they will be deployed exactly, therefore it would be great if I could change my settings in the Foreman UI and it would be possible to re-configure it using an Ansible script.
  2. Blue green deployments: changing the environment for a host can be taken into account for situation in which we want to switch over deployments of servers?

If this is not possible (and AFAIK it isn’t but could be that I’m wrong); would this not be a nice-additional set of parameters?
Perhaps this could also trigger a debate on “rex triggers”; for instance: when parameters are changed by a user, this triggers reconfiguring the host via the CM of choice?

I think the above-mentioned things are possible with Puppet; no?

Hi, this is not supported at the moment. I can imagine having a predefined remote execution job backed by ansible that would apply the changes made in UI, but even that will not be a trivial feature given the number of ways a host can be configured. Then again, we can start just with a certain area, like networking, and see how that goes.

The ‘rex triggers’ is certainly an interesting idea, you can definitely bring it up to start a discussion about how it should look like if it is a feature that you would like to see.

Puppet runs periodically on the hosts, checks the current host configuration and changes it if it does not correspond to how the host should be configured. But if you change network interface in Foreman UI, Puppet will not propagate it to the host - when facts are uploaded, the information will be updated in Foreman.

Hey @Ondrej_Prazak,
Thank you for this reply, I will try and make a PoC based upon networks first; and check if it scales out for the rest of the relevant parameters as well. At least, the networking part, for me, is the most pressing one :slight_smile:

As for the rex trigger; I’ll ponder a bit further on the idea and create an RFC for this one.

Can’t you use the host ENC for it? It contains foreman_interfaces. It’s what the Puppet ENC uses.

Hi @ekohl, looks like this could do the job! Now i just need to figure out how to pass this data to ansible (but I think it’s limited in effort). WIll try and find some time tonight to play with this