Include vars in role tasks
ansible
Solution
It was my own fault in the end... I tested this by using the `debug` module and `tags` like this:
- include_vars: ../../another_role/defaults/main.yml
- debug: msg={{ variable }}
tags: foo
and then executing the playbook like this:
ansible-playbook -vvvv playbook.yml --tags foo
Once I left out the tags, it works (of course). The problem was that I should have added the tags to the `include_vars` command as well like this:
- include_vars: ../../another_role/defaults/main.yml
tags: foo
- debug: msg={{ variable }}
tags: foo
Problem
In a role, I am trying to load some variables from another role. (If that role was included in the current play, the variables would be accessible, but it's not so they're not.) So I tried this: ``` - include_vars: ../../another_role/defaults/main.yml ``` But it doesn't work, no error but the variables are still undefined. So I tried to be smart and symlink the file to `vars/another_role_defaults.yml` in the role where I want to use the vars and then include it like this: ``` - include_vars: another_role_defaults.yml ``` Same result, no error (why doesn't it throw an error if the file cannot be found??) but variables are still undefined. I tried this as well, for good measure, but still no cigar. ``` - include_vars: ../vars/another_role_defaults.yml ``` What am I doing wrong?