diff --git a/lib/ansible/plugins/action/set_fact.py b/lib/ansible/plugins/action/set_fact.py index 536bb69c6d..623c6be8b0 100644 --- a/lib/ansible/plugins/action/set_fact.py +++ b/lib/ansible/plugins/action/set_fact.py @@ -36,7 +36,7 @@ class ActionModule(ActionBase): facts = dict() - cacheable = bool(self._task.args.pop('cacheable', False)) + cacheable = boolean(self._task.args.pop('cacheable', False)) if self._task.args: for (k, v) in iteritems(self._task.args): 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 65c6c4dfa5..450f8da28e 100644 --- a/test/integration/targets/set_fact/set_fact_cached_1.yml +++ b/test/integration/targets/set_fact/set_fact_cached_1.yml @@ -33,6 +33,18 @@ that: - ansible_foobar_not_cached == 'this_should_not_be_cached' + - name: set another non persistent fact that will not be cached + set_fact: "cacheable=no fact_not_cached='this_should_not_be_cached!'" + + - name: show fact_not_cached fact after being set + debug: + var: fact_not_cached + + - name: assert fact_not_cached is correct value + assert: + that: + - fact_not_cached == 'this_should_not_be_cached!' + - name: the second play hosts: localhost tasks: 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 abfc67f38b..7ca26b9dcb 100644 --- a/test/integration/targets/set_fact/set_fact_cached_2.yml +++ b/test/integration/targets/set_fact/set_fact_cached_2.yml @@ -19,3 +19,12 @@ assert: that: - ansible_foobar_not_cached is undefined + + - name: show fact_not_cached fact + debug: + var: fact_not_cached + + - name: assert fact_not_cached is not cached + assert: + that: + - fact_not_cached is undefined