Dear Experts,
I have a host file like something below:
`
[servers]
1.2.3.4
1.2.3.5
1.2.3.6
`
and also i have a script called test like
ansible servers -m -shell "docker ps"
Now as per my understanding the script will run on all hosts of group called servers correct ?
if yes, then I dont want ansible to run that code all hosts.
- check first node that 1.2.3.4 if its reachable then ssh into to execute above code (test)…skip next two hosts as first node is reachable and there is no need for second and third node.
- if first node in group not reachable, then try to connect 1.2.3.5 and execute the test code… else skip move to next check
so how can we achieve this kind or orchestration on ansible inventory hosts ?
can some guide me…