Created
July 30, 2021 13:14
-
-
Save andif888/f4141f5cee38cc14daf245964ffdb9dd to your computer and use it in GitHub Desktop.
ansible delegate gather facts
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
- name: delegate update facts of terraform_dc1 | |
setup: | |
delegate_to: 'terraform_dc1' | |
delegate_facts: yes | |
become_method: runas | |
become_user: 'localadmin' | |
when: | |
- hostvars["terraform_dc1"]["ansible_ip_addresses"] is not defined | |
- name: display first ipv4 | |
debug: | |
msg: "{{ hostvars["terraform_dc1"]["ansible_ip_addresses"] | ansible.netcommon.ipv4 | first }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment