I did exactley the same thing as you have done @jeremywat,
with two playbooks : one storing a variable with a cacheable=true
set_fact
and another playbook to read the variable and it works.
We have Ansible Automation Platform 2.5 (Automation Controller Version 4.6.3)
Reading the pseudo fact as a variable (first option) did work for us.
First playbook :
- name: "Playbook 1"
hosts:
- all
tasks:
- set_fact:
sysops_var1: 'toto tutu tata'
cacheable: true
Second playbook :
- name: "Playbook 2"
hosts:
- all
tasks:
- debug:
msg: "AS A VAR : {{ sysops_var1 }}"
- debug:
msg: "AS A FACT : {{ ansible_facts }}"
After having run the first playbook, and then the second playbook (both with Enable Fact Storage: checked
), both options are successful :
TASK [debug] *******************************************************************
task path: /runner/project/play3.yaml:8
ok: [localhost] => {
"msg": "AS A VAR : toto tutu tata"
}
...
"msg": "AS A FACT : {
...
'lvm': 'N/A', 'sysops_var1': 'toto tutu tata', 'fips': False,
...