ansible-collections / ibm_zos_core

Red Hat Ansible Certified Content for IBM Z
76 stars 44 forks source link

[Enhancement] [zos_copy] [zos_job_submit] Files in templates dir of role are not found by module #940

Open rexemin opened 1 year ago

rexemin commented 1 year ago

Is there an existing issue for this?

Are the dependencies a supported version?

IBM Z Open Automation Utilities

v1.2.2

IBM Enterprise Python

v3.10.x

IBM z/OS Ansible core Version

v1.7.0-beta.1

ansible-version

latest

z/OS version

None

Ansible module

No response

Bug description

When executing tasks inside a role, Ansible will automatically resolve paths for files inside the subdirectories files, templates and tasks of the role:

When you use the roles option at the play level, for each role ‘x’: ... Any copy, script, template or include tasks (in the role) can reference files in roles/x/{files,templates,tasks}/ (dir depends on task) without having to path them relatively or absolutely.

However, when using zos_copy, this behavior doesn't occur. This item is for researching how Ansible finds files inside of a role and see if we can tell Ansible to extend this behavior to modules in our collection.

While this bug has only been reported for zos_copy, it's highly likely that it also affects zos_job_submit.

Playbook verbosity output.

No response

Ansible configuration.

No response

Contents of the inventory

No response

Contents of group_vars or host_vars

No response

rexemin commented 12 months ago

After triaging this issue and going through the code for copy and template from the community, it appears both modules handle role paths internally, as opposed to being handled by the engine. From this, I'm changing this issue from a bug to an enhancement, as we now require new work for our modules to handle roles.

This item would require changes to the action plugins of modules from our collection that handle local files, which would be: