Some playbooks exhibiting advanced features of Ansible
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
536 B

---
- name: A standard fact can be defined in a playbook...
gather_facts: no
hosts: localhost
tasks:
- set_fact:
myfact123: test
- assert:
that:
# A fact is available as a standard variable
- "myfact123 == 'test'"
# But not part of the "ansible_facts" dictionary
- "'myfact123' not in ansible_facts"
- name: and used in another role/playbook !
gather_facts: no
hosts: localhost
tasks:
- assert:
that:
- "myfact123 == 'test'"
- "'myfact123' not in ansible_facts"