-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheg.yml
35 lines (26 loc) · 996 Bytes
/
eg.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
- name: Ansible Variable Example Playbook
hosts: teleport_nodes
tasks:
# display the variable data type
- debug:
msg:
- " Data type of 'ansible_architecture' is {{ ansible_architecture | type_debug }} "
- " Data type of 'ansible_apparmor' is {{ ansible_apparmor | type_debug }} "
- " Data type of 'ansible_all_ipv4_addresses' is {{ ansible_all_ipv4_addresses | type_debug }} "
# Simply printing the value of fact which is Ansible UnSafe Text type
- debug:
msg: "{{ ansible_architecture }}"
# Accessing an element of dictionary
- debug:
msg: "{{ansible_distribution_version}}"
- debug:
msg: "{{ansible_distribution_release}}"
- debug:
msg: "{{ansible_distribution}}"
# Accessing the list
- debug:
msg: "{{ansible_all_ipv4_addresses}}"
# Accessing the Second Element of the list
- debug:
msg: "{{ansible_all_ipv4_addresses[1]}}"