Junior — Middle
Can you name the types of variables used in Ansible?
sobes.tech AI
Answer from AI
The following variable types are used in Ansible:
- Strings (string) — simple text values.
- Numbers (integer, float) — numeric values.
- Booleans (boolean) — True or False.
- Lists (list) — ordered collections of elements.
- Dictionaries (dictionary) — key-value pairs.
- Special types — for example,
None(null), as well as variables obtained from facts, inventory, or dynamically defined.
Variables can be set in YAML files, in inventory, via command line, in playbooks, roles, etc. Example of a list and dictionary in Ansible:
users:
- name: alice
uid: 1001
- name: bob
uid: 1002
config:
path: /etc/myapp
enabled: true