Page 1 of 1

Replace hostgroup on 100's of hosts

Posted: Thu May 27, 2021 8:16 am
by ottow
Hi,

We are expanding our deployment of mod_gearman workers and need to switch several 100s of hosts to a new worker.
To do this, we need to remove a mg_objects_ hostgroup currently set on each host (not inherited) and add a new, different mg_objects hostgroup.

What would be the easiest way to do this?
We've looked at using the Bulk Modifications Tool, but it is really cumbersome to remove a hostgroup from large numbers of individual hosts using it....

Is there a better solution?

Re: Replace hostgroup on 100's of hosts

Posted: Thu May 27, 2021 5:08 pm
by benjaminsmith
Hi @ottow,

The other solution would be to script this out using the API, see the PUT config/hostgroup/<hostgroup_name> endpoint. If this something you commonly do, then it makes sense to take a little more time to do this programitcally. One caveat, that endpoint will overwrite the entire host group, you cannot append a single member to the hostgroup using the PUT option.

Otherwise, the Remove Host Group in the Bulk Mods Tool is probably the best choice.

Regards,
Benjamin

Re: Replace hostgroup on 100's of hosts

Posted: Fri May 28, 2021 2:33 am
by ottow
I see. Thanks.

Re: Replace hostgroup on 100's of hosts

Posted: Fri May 28, 2021 9:30 am
by benjaminsmith
Hi Ottow,

Let's know if you have any other questions or if it's okay to close this topic.

Best Regards