Skip to content

Instantly share code, notes, and snippets.

@mageddo
Created January 26, 2019 18:04
Show Gist options
  • Save mageddo/9bc10b8f5c49f4d69b3146d8b62c7e35 to your computer and use it in GitHub Desktop.
Save mageddo/9bc10b8f5c49f4d69b3146d8b62c7e35 to your computer and use it in GitHub Desktop.
$ ansible-playbook -i hosts -c local playbook.yml 

PLAY [main[0]] *******************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
ok: [127.0.0.1]

TASK [command] *******************************************************************************************************************************************************************************************************************************
changed: [127.0.0.1]

TASK [debug] *********************************************************************************************************************************************************************************************************************************
ok: [127.0.0.1] => {
    "msg": "0.0.0.0"
}

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
127.0.0.1                  : ok=3    changed=1    unreachable=0    failed=0   
[main]
127.0.0.1 private_ip=0.0.0.0
192.168.0.53 private_ip=0.0.0.0
- hosts: main[0]
tasks:
- command: echo "Hey Asshole"
register: out
- debug:
msg: "{{ hostvars[groups['main'][1]].private_ip}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment