Ansible inventory group array pointer to parent -


i want check if knows if there solution problem facing in ansible.

i have inventory file looks this:-

[clustera] 10.0.0.1 10.0.0.2 10.0.0.3 ....  [clusterb] 10.1.0.1 10.1.0.2 10.1.0.3 ....  [web-lb] 10.0.0.1 10.1.0.1 

instead of repeating ip address in web-lb group, want this:-

[web-lb:children] clustera[0] clusterb[0] 

if can script group mentioned above, don't need duplicate ip addresses, , can mix different item group group, eg

[weba-lb:children] clustera[1] clustera[5] clusterb[3] 

updated

having below configuration doesn't work well

[weba-lb] clustera[1] 

error:

bbed5901ea74:~$ ansible -i hosts --list-hosts hosts (6): 10.1.0.1 10.1.0.2 10.1.0.3 10.0.0.1 10.0.0.2 10.0.0.3 bbed5901ea74:~$ vi hosts bbed5901ea74:~$ ansible -i hosts --list-hosts error! attempted read "hosts" yaml: syntax error while loading yaml.   error appears have been in '/home/jenkins/hosts': line 2, column 1,  may elsewhere in file depending on exact syntax problem.  offending line appears be:  [clustera] 10.0.0.1 ^ here  attempted read "hosts" ini file: host range must begin:end or  begin:end:step 

i don't think can use :children combined individual selector [] that. :children suffix denotes group of groups.

so this:

[web-lb] clustera[0] clusterb[0] 

but not this:

[web-lb:children] clustera[0] clusterb[0] 

see ansible's patterns , inventory documentation more details. ansible flexible. can use ! symbol exclude children group.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -