Page 1 of 1

Excluding hostgroup from hostgroup!

Posted: Fri Dec 06, 2019 3:01 pm
by BanditBBS
This has been asked a few times in the past by others in here.

I have 3 main groups of hosts, hosts1, hosts2 and hosts3.

I have a HG1 and HG2 created and all the proper hosts assigned. I want to create a HG3 but don't want to have to remember to update it when adding new hosts. Ideally I'd add ALL 50 hostgroups into HG3 and EXCLUDE HG1 and HG2 from it. I can't think of any possible way to do this since you can't exclude a HG in a HG Members definition.

Anyone have any ideas?

Re: Excluding hostgroup from hostgroup!

Posted: Fri Dec 06, 2019 3:27 pm
by BanditBBS
My only thought right now is to write a script that creates a static config file. Adds * for hosts as members and also pulls from the api all the members of the other two hostgroups. It then writes them as members but excluded. Put this script in cron so it runs 1 or 2 times a day and I'll have my automatically updated hostgroup.

Anyone think of a better method?

Re: Excluding hostgroup from hostgroup!

Posted: Fri Dec 06, 2019 3:52 pm
by scottwilkerson
BanditBBS wrote:My only thought right now is to write a script that creates a static config file. Adds * for hosts as members and also pulls from the api all the members of the other two hostgroups. It then writes them as members but excluded. Put this script in cron so it runs 1 or 2 times a day and I'll have my automatically updated hostgroup.

Anyone think of a better method?
This is really about the best I can think of as you cannot exclude hostgroups from other hostgroups..

Re: Excluding hostgroup from hostgroup!

Posted: Fri Dec 06, 2019 3:53 pm
by BanditBBS
scottwilkerson wrote:
BanditBBS wrote:My only thought right now is to write a script that creates a static config file. Adds * for hosts as members and also pulls from the api all the members of the other two hostgroups. It then writes them as members but excluded. Put this script in cron so it runs 1 or 2 times a day and I'll have my automatically updated hostgroup.

Anyone think of a better method?
This is really about the best I can think of as you cannot exclude hostgroups from other hostgroups..
OK Scott, just wanted to hear that...thanks! Umm, feature request???? LOL

You can lock this!

Re: Excluding hostgroup from hostgroup!

Posted: Fri Dec 06, 2019 4:02 pm
by scottwilkerson
BanditBBS wrote:
scottwilkerson wrote:
BanditBBS wrote:My only thought right now is to write a script that creates a static config file. Adds * for hosts as members and also pulls from the api all the members of the other two hostgroups. It then writes them as members but excluded. Put this script in cron so it runs 1 or 2 times a day and I'll have my automatically updated hostgroup.

Anyone think of a better method?
This is really about the best I can think of as you cannot exclude hostgroups from other hostgroups..
OK Scott, just wanted to hear that...thanks! Umm, feature request???? LOL

You can lock this!
;)

Locking thread