Created
September 23, 2013 09:00
-
-
Save davidbirdsong/6668127 to your computer and use it in GitHub Desktop.
add_host doesn't add hosts to new group
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hosts: all:!undef_broken:!undef_missing | |
| gather_facts: false | |
| tasks: | |
| - add_host: name={{ inventory_hostname }} groups=alive | |
| when: "'broken' != '{{ state }}' and 'missing' != '{{ state }}'" | |
| - shell: echo " define 'alive' for host {{ inventory_hostname }}" | |
| ###### when run: | |
| PLAY [all:!undef_broken:!undef_missing] *************************************** | |
| TASK: [add_host name={{inventory_hostname}} groups=alive] ********************* | |
| creating host via 'add_host': hostname=svab1 | |
| added host to group via add_host module: alive | |
| ok: [svab1] => {"new_groups": ["alive"], "new_host": "svab1"} | |
| TASK: [shell echo " define 'alive' for host {{inventory_hostname}}"] ********** | |
| changed: [svab2] => {"changed": true, "cmd": "echo \" define 'alive' for host svab2\" ", "delta": "0:00:00.002368", "end": "2013-09-23 08:57:12.168056", "rc": 0, "start": "2013-09-23 08:57:12.165688", "stderr": "", "stdout": " define 'alive' for host svab2"} | |
| changed: [svab4] => {"changed": true, "cmd": "echo \" define 'alive' for host svab4\" ", "delta": "0:00:00.002228", "end": "2013-09-23 08:47:43.311019", "rc": 0, "start": "2013-09-23 08:47:43.308791", "stderr": "", "stdout": " define 'alive' for host svab4"} | |
| changed: [svab1] => {"changed": true, "cmd": "echo \" define 'alive' for host svab1\" ", "delta": "0:00:00.002531", "end": "2013-09-23 08:57:12.211899", "rc": 0, "start": "2013-09-23 08:57:12.209368", "stderr": "", "stdout": " define 'alive' for host svab1"} | |
| changed: [svab3] => {"changed": true, "cmd": "echo \" define 'alive' for host svab3\" ", "delta": "0:00:00.002390", "end": "2013-09-23 08:48:58.542964", "rc": 0, "start": "2013-09-23 08:48:58.540574", "stderr": "", "stdout": " define 'alive' for host svab3"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment