Mass-adding a parameter to a host

Hi,

In a host list generated by adding a filter, I can tick a number of hosts in the leftmost column and then choose “Edit Parameter” from the “Select Action” dropdown. In the resulting dialog, I can only edit parameters that have been set previously for all selected hosts since those are the only fields that show up in the list.

How can I mass-add a parameter to a list of hosts that has previously been unset (or inherited from the host group) on certain/all hosts in a selection list?

Greetings
Marc

This maybe better to set from the api or hammer-cli as a loop (Atleast that would be my approach). Export the list of hosts you want to use and write a small while loop using the list above to set the parameter you want.

We used to do that with hammer, but there seems to be an issue with hammer and foreman 1.17 that I have not fully investigated yet. That’s the reason why we want to do that from the GUI.

does it make sense to set the parameter on a higher level in the hierarchy
instead ? the idea was always to define defaults on a higher level and
override as needed on specific hosts?

Yes, and now an override is needed on a small number of specific hosts and people don’t want to do that manually on each host.

If “small number” is still too large for doing by hand, perhaps mass moving them into a sub-hostgroup would work? You could set the parameter at the hostgroup level, and set pretty much everything else to “Inherit from Parent”.

Depending on the hierarchy - you could create hostgroup for this small subset of hosts and override these in the hostgroup directly or do a merged parameter set.

For some reason this didn’t post but what @Gwmngilfen said

Thanks for all the replies that suggested using hostgroups. That was not my question.
The reason for that not being my question is that the host groups structure in the given setup is used for something different and is used inside puppet code. it can therefore not be changed easily.

I filed Feature #24010: Host list should have a possibility to mass-add host variables - Foreman

Greetings
Marc

1 Like