ansible vars_from in include_role does not find the var files listed under "with_items"

Viewed 33

I am trying to run below on ansible ansible tower with ansible version 2.9.27.

- hosts: jdk_patching_list
  gather_facts: true
  pre_tasks:
      ...
      << dynamically generate following on remote server using shell module >>
      << /opt/oracle/opatch_jdk/jdk_patch_role/vars/12.1.0.2.0.yml >>
      << /opt/oracle/opatch_jdk/jdk_patch_role/vars/19.0.0.0.0.yml >>
      ...
      ...
  tasks:
    - name: calling jdk_patch_role
      include_role:
        name: jdk_patch_role
        vars_from: "{{ item }}
      with_items:
        - /opt/oracle/opatch_jdk/roles/jdk_patch_role/vars/12.1.0.2.yml
        - /opt/oracle/opatch_jdk/roles/jdk_patch_role/vars/19.0.0.0.yml

But it fails with

TASK [calling jdk_patch_role] ***************
ERROR! Could not find specified file in role: vars//opt/oracle/opatch_jdk/roles/jdk_patch_role/vars/12.1.0.2.0
ERROR! Could not find specified file in role: vars//opt/oracle/opatch_jdk/roles/jdk_patch_role/vars/19.0.0.0.0

I have been researching on this extensively and found out that there are couple of bugs in version 2.5 with same behavior, but it does not say if it's ever been fixed.

Any thoughts?

0 Answers
Related