Closed
Description
If i have a structure like this in my role that includes this role
# my awesome-role tree output
.
├── defaults
│ ├── Darwin.yml
│ ├── Debian.yml
│ └── main.yml
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── tasks
│ ├── main.yml
then this task
- name: include OS family/distribution specific variables
include_vars: "{{ item }}"
with_first_found:
- "../defaults/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "../defaults/{{ ansible_distribution | lower }}.yml"
- "../defaults/{{ ansible_os_family | lower }}.yml"
includes my own Debian.yml (awesome-role/defaults/Debian.yml) instead of ansiblebit/oracle-java/defaults/Debian.yml and then the role fails with undefined variables
[...]
==> ubuntu_xenial64: TASK [ansiblebit.oracle-java : include OS family/distribution specific variables] ***
==> ubuntu_xenial64: ok: [localhost] => (item=/home/ubuntu/awesome-role/vars/../defaults/debian.yml)
==> ubuntu_xenial64:
[...]
==> ubuntu_xenial64: TASK [ansiblebit.oracle-java : ensure Java is installed] ***********************
==> ubuntu_xenial64: fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'oracle_java_state' is undefined\n\nThe error appears to have been in '/home/ubuntu/.ansible-roles/ansiblebit.oracle-java/tasks/debian/main.yml': line 12, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: ensure Java is installed\n ^ here\n"}
As a workaround i've manually defined the contents of defaults/debian.yml in my awesome-role/defaults/Debian.yml and its working.