Created
August 15, 2017 08:22
-
-
Save askedrelic/873421f4fb30823c089763b1551aa28d to your computer and use it in GitHub Desktop.
Ansible snippets
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
- debug: var=another_fact | |
- name: Perform a rot13 | |
debug: msg="The word {{ roman_name }} becomes {{ roman_name | rot13 }}" | |
- name: get hostvars for servers' ansible_default_ipv4 | |
set_fact: | |
ip_list1: "{{ hostvars|fetchlistfromdict(groups.servers)|map(attribute='ansible_default_ipv4.address')|list }}" | |
- name: turn to FOO | |
debug: msg="{{'test'|foo}}" | |
- name: Show the list of ansible_default_ipv4 | |
debug: var="{{ ip_list1 }}" | |
- name: Get the servers' ansible_all_ipv4_addresses | |
set_fact: | |
ip_list2: "{{hostvars|fetchlistfromdict(groups.servers)|map(attribute='ansible_all_ipv4_addresses')|list }}" | |
- name: Show the list we obtained for ansible_all_ipv4_addresses | |
debug: var="{{ip_list2}}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment