mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
YAML
47 lines
1.1 KiB
YAML
---
|
|
- name: the first play
|
|
hosts: localhost
|
|
tasks:
|
|
- name: show foobar fact before
|
|
debug:
|
|
var: ansible_foobar
|
|
|
|
- name: set a persistent fact foobar
|
|
set_fact:
|
|
ansible_foobar: 'blippy'
|
|
cacheable: true
|
|
|
|
- name: show foobar fact after
|
|
debug:
|
|
var: ansible_foobar
|
|
|
|
- name: assert ansible_foobar is correct value
|
|
assert:
|
|
that:
|
|
- ansible_foobar == 'blippy'
|
|
|
|
- name: set a non persistent fact that will not be cached
|
|
set_fact:
|
|
ansible_foobar_not_cached: 'this_should_not_be_cached'
|
|
|
|
- name: show ansible_foobar_not_cached fact after being set
|
|
debug:
|
|
var: ansible_foobar_not_cached
|
|
|
|
- name: assert ansible_foobar_not_cached is correct value
|
|
assert:
|
|
that:
|
|
- ansible_foobar_not_cached == 'this_should_not_be_cached'
|
|
|
|
- name: the second play
|
|
hosts: localhost
|
|
tasks:
|
|
- name: show foobar fact after second play
|
|
debug:
|
|
var: ansible_foobar
|
|
|
|
- name: assert ansible_foobar is correct value
|
|
assert:
|
|
that:
|
|
- ansible_foobar == 'blippy'
|