Ansible: restricting group vars with groups of groups -


i have ansible hosts file looks that:

[myhosts] 192.168.0.1 192.168.0.2  [group1:children] myhosts  [group2:children] myhosts 

along side group vars files group1 , group2 (and incidentally myhosts) declaring common variables different values.

here directory layout (that follows best pratices):

hosts main.yml group_vars/     group1.yml     group2.yml     myhosts.yml 

therefore, both group vars files group1 , group2 automatically included ansible when host belongs both groups.

for record, callinng ansible on playblook following pattern target (specified in command line):

192.168.0.1:&group1 

considering that, how can make ansible include group vars file associated group1 (and children group myhosts) ? possible ?

an alternate solution renaming group vars files of group1 , group2 different (to prevent automatic includes) , includes in separate "proxy" playbooks, specific each subgroup, seems less clean me.

note: moment not case, in futur group1 , group2 have few hosts not in common.

the hosts value of play way set target hosts of play, but it not view on hosts.
if host belongs multiple groups always load vars group_vars of groups, not 1 specified in play.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -