Skip to content

Instantly share code, notes, and snippets.

@nrb
Last active November 30, 2016 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrb/a3fbe33a0596b1d42e39302cffefbe56 to your computer and use it in GitHub Desktop.
Save nrb/a3fbe33a0596b1d42e39302cffefbe56 to your computer and use it in GitHub Desktop.
Trying out ansible's group-of-groups behavior, where the top-level group also includes hosts. Targeting groups B &C do *not* include the parent and chidlren; targetting group A appears to get all hosts correctly.
[groupA]
containerA ansible_host=10.3.114
groupB
groupC
[groupB]
containerB ansible_host=10.3.45
[groupC]
containerC ansible_host=10.0.3.60
NAME STATE IPV4 IPV6 AUTOSTART
------------------------------------------------
containerA RUNNING 10.0.3.114 - NO
containerB RUNNING 10.0.3.45 - NO
containerC RUNNING 10.0.3.60 - NO
root@nrb-ord-aio:~# ansible -m ping -i inventory groupA
containerC | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 10.0.3.60 port 22: Connection refused\r\n",
"unreachable": true
}
containerA | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 10.3.114 port 22: Connection timed out\r\n",
"unreachable": true
}
containerB | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 10.3.45 port 22: Connection timed out\r\n",
"unreachable": true
}
root@nrb-ord-aio:~# ansible -m ping -i inventory groupC
containerC | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 10.0.3.60 port 22: Connection refused\r\n",
"unreachable": true
}
root@nrb-ord-aio:~# ansible -m ping -i inventory groupB
containerB | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 10.3.45 port 22: Connection timed out\r\n",
"unreachable": true
}
root@nrb-ord-aio:~# ansible -m ping -i inventory containerA
containerA | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 10.3.114 port 22: Connection timed out\r\n",
"unreachable": true
}
root@nrb-ord-aio:~# ansible -m ping -i inventory containerC
containerC | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 10.0.3.60 port 22: Connection refused\r\n",
"unreachable": true
}
root@nrb-ord-aio:~# ansible -m ping -i inventory containerB
containerB | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host 10.3.45 port 22: Connection timed out\r\n",
"unreachable": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment