diff --git a/test/integration/targets/set_fact/set_fact_cached_1.yml b/test/integration/targets/set_fact/set_fact_cached_1.yml index ffb03c8886..65c6c4dfa5 100644 --- a/test/integration/targets/set_fact/set_fact_cached_1.yml +++ b/test/integration/targets/set_fact/set_fact_cached_1.yml @@ -8,7 +8,7 @@ - name: set a persistent fact foobar set_fact: - ansible_foobar: 'blippy' + ansible_foobar: 'foobar_from_set_fact_cacheable' cacheable: true - name: show foobar fact after @@ -18,7 +18,7 @@ - name: assert ansible_foobar is correct value assert: that: - - ansible_foobar == 'blippy' + - ansible_foobar == 'foobar_from_set_fact_cacheable' - name: set a non persistent fact that will not be cached set_fact: @@ -43,4 +43,129 @@ - name: assert ansible_foobar is correct value assert: that: - - ansible_foobar == 'blippy' + - ansible_foobar == 'foobar_from_set_fact_cacheable' + +- name: show ansible_nodename + hosts: localhost + tasks: + - name: show nodename fact after second play + debug: + var: ansible_nodename + +- name: show ansible_nodename overridden with var + hosts: localhost + vars: + ansible_nodename: 'nodename_from_play_vars' + tasks: + - name: show nodename fact after second play + debug: + var: ansible_nodename + +- name: verify ansible_nodename from vars overrides the fact + hosts: localhost + vars: + ansible_nodename: 'nodename_from_play_vars' + tasks: + - name: show nodename fact + debug: + var: ansible_nodename + + - name: assert ansible_nodename is correct value + assert: + that: + - ansible_nodename == 'nodename_from_play_vars' + +- name: set_fact ansible_nodename + hosts: localhost + tasks: + - name: set a persistent fact nodename + set_fact: + ansible_nodename: 'nodename_from_set_fact_cacheable' + + - name: show nodename fact + debug: + var: ansible_nodename + + - name: assert ansible_nodename is correct value + assert: + that: + - ansible_nodename == 'nodename_from_set_fact_cacheable' + +- name: verify that set_fact ansible_nodename non_cacheable overrides ansible_nodename in vars + hosts: localhost + vars: + ansible_nodename: 'nodename_from_play_vars' + tasks: + - name: show nodename fact + debug: + var: ansible_nodename + + - name: assert ansible_nodename is correct value + assert: + that: + - ansible_nodename == 'nodename_from_set_fact_cacheable' + +- name: verify that set_fact_cacheable in previous play overrides ansible_nodename in vars + hosts: localhost + vars: + ansible_nodename: 'nodename_from_play_vars' + tasks: + - name: show nodename fact + debug: + var: ansible_nodename + + - name: assert ansible_nodename is correct value + assert: + that: + - ansible_nodename == 'nodename_from_set_fact_cacheable' + +- name: set_fact ansible_nodename cacheable + hosts: localhost + tasks: + - name: set a persistent fact nodename + set_fact: + ansible_nodename: 'nodename_from_set_fact_cacheable' + cacheable: true + + - name: show nodename fact + debug: + var: ansible_nodename + + - name: assert ansible_nodename is correct value + assert: + that: + - ansible_nodename == 'nodename_from_set_fact_cacheable' + + +- name: verify that set_fact_cacheable in previous play overrides ansible_nodename in vars + hosts: localhost + vars: + ansible_nodename: 'nodename_from_play_vars' + tasks: + - name: show nodename fact + debug: + var: ansible_nodename + + - name: assert ansible_nodename is correct value + assert: + that: + - ansible_nodename == 'nodename_from_set_fact_cacheable' + +- name: the fourth play + hosts: localhost + vars: + ansible_foobar: 'foobar_from_play_vars' + tasks: + - name: show example fact + debug: + var: ansible_example + + - name: set a persistent fact example + set_fact: + ansible_example: 'foobar_from_set_fact_cacheable' + cacheable: true + + - name: assert ansible_example is correct value + assert: + that: + - ansible_example == 'foobar_from_set_fact_cacheable' diff --git a/test/integration/targets/set_fact/set_fact_cached_2.yml b/test/integration/targets/set_fact/set_fact_cached_2.yml index 8d7a9f613a..abfc67f38b 100644 --- a/test/integration/targets/set_fact/set_fact_cached_2.yml +++ b/test/integration/targets/set_fact/set_fact_cached_2.yml @@ -9,7 +9,7 @@ - name: assert ansible_foobar is correct value when read from cache assert: that: - - ansible_foobar == 'blippy' + - ansible_foobar == 'foobar_from_set_fact_cacheable' - name: show ansible_foobar_not_cached fact debug: