Hi,
How to set a variable inside role A and use it inside role B ? Role B is listed in dependencies sections in meta/main.yml of role A and I see its output then call role A.
I have tried to use set_fact module or register variable, but no luck.
role A:
`
- name: Print test var from another role
debug: msg=“{{ test_var }}”
`
role B:
`
-
name: Save some vars in register
shell: echo “BLAH”
register: test_var -
name: Save some vars in facts
set_fact:
test_var: BLAH
`
ansible-playbook’s Output:
fatal: [localhost] => One or more undefined variables: ‘test_var’ is undefined
FATAL: all hosts have already failed – aborting
If I set test_var via role’s parameter in site.yml, all works fine:
site.yml
`