$ ansible-playbook -i hosts -c local playbook.yml
PLAY [main[0]] *******************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
ok: [127.0.0.1]
TASK [debug] *********************************************************************************************************************************************************************************************************************************
ok: [127.0.0.1] => {
"msg": "192.168.0.53"
}
PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0
Created
January 26, 2019 16:30
-
-
Save mageddo/5a4033272ba07c25d6b76723b1785693 to your computer and use it in GitHub Desktop.
Acessing inventory hosts inside playbook
This file contains 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
[main] | |
127.0.0.1 | |
192.168.0.53 |
This file contains 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: main[0] | |
tasks: | |
- debug: | |
msg: "{{ groups['main'][1] }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment