-
Notifications
You must be signed in to change notification settings - Fork 13
playbooks: guestfs: fix import_tasks file path #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@chucklever this is also a GitHub PR for testing the process you are discussing. Note: I would have merged this fix directly into mainline if the tests passed. However, I wanted to check with you first: do you have any preference for using relative paths versus full paths, such as those used in the main guestfs role’s main.yaml file? This - file: install-deps/debian/main.yml
+ file: "{{ role_path }}/tasks/install-deps/main.yml"Note that I haven't tested the proposal but I assume it works too for nested import_tasks. |
|
I have been using full pathnames only recently. I agree that should be more reliable in general. What I don't yet understand here is why I didn't see this problem during my own testing. |
|
On a related note, I'm not convinced that import_tasks is better than include_tasks for install-deps/. All of these have a when: clause, which possibly makes dynamic inclusion a more reliable choice. |
I think this is because of the Ansible version my machine has. This is what I'm seeing: This is the version I'm currently using: |
|
Just for comparison: I don't have any problem adding {{ role_path }} to the pathnames. |
I'll add the role_path and merge this. |
I think I'm running a "too new" release and yours it's a bit "too old"? 2.16 is EOL May 2026 |
Fwiw, I think I am using the release packaged by Fedora, just to lower my own administrative chores ... but they are often one or two versions backlevel for everything, even on the currently supported Fedora releases. F41 will be EOL in a few months. Thank you for testing the guestfs playbook! |
Ansible in Debian trixie uses beta releases... I'd probably get v2.19.0b4 if I update now. Latest beta is b6. https://packages.debian.org/trixie/ansible-core |
e464487 to
625e294
Compare
guestfs main task YAML file import_tasks for intalling dependencies
with:
file: "{{ role_path }}/tasks/install-deps/main.yml"
That file also import_tasks using distro specific tasks. This file path
needs to use the path from the role tasks/ path and not from where the
file is located.
Logs:
make bringup
...
ansible-playbook -vv \
--inventory localhost, \
playbooks/guestfs.yml \
--extra-vars=@./extra_vars.yaml \
--tags install-deps
ansible-playbook [core 2.19.0b2]
config file = /scratch/dagomez/linux-kdevops/kdevops/ansible.cfg
configured module search path =
['/home/dagomez/.ansible/plugins/modules',
'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/dagomez/.ansible/collections:/usr
/share/ansible/collections
executable location = /usr/bin/ansible-playbook
python version = 3.13.3 (main, Apr 10 2025, 21:38:51) [GCC 14.2.0]
(/usr/bin/python3)
jinja version = 3.1.6
pyyaml version = 6.0.2 (with libyaml v0.2.5)
Using /scratch/dagomez/linux-kdevops/kdevops/ansible.cfg as config file
statically imported:
/scratch/dagomez/linux-kdevops/kdevops/playbooks/roles/guestfs/tasks/
install-deps/main.yml
[ERROR]: Unable to retrieve file contents.
Could not find or access
'/scratch/dagomez/linux-kdevops/kdevops/playbooks/debian/main.yml' on
the Ansible Controller.
If you are using a module and expect the file to exist on the remote,
see the remote_src option: [Errno 2] No such file or directory:
'/scratch/dagomez/linux-kdevops/kdevops/playbooks/debian/main.yml
Signed-off-by: Daniel Gomez <[email protected]>
625e294 to
7b43ac7
Compare
guestfs main task YAML file import_tasks for intalling dependencies with:
file: "{{ role_path }}/tasks/install-deps/main.yml"
That file also import_tasks using distro specific tasks. This file path needs to use the path from the role tasks/ path and not from where the file is located.
Logs:
make bringup
...
ansible-playbook -vv
--inventory localhost,
playbooks/guestfs.yml
--extra-vars=@./extra_vars.yaml
--tags install-deps
ansible-playbook [core 2.19.0b2]
config file = /scratch/dagomez/linux-kdevops/kdevops/ansible.cfg
configured module search path =
['/home/dagomez/.ansible/plugins/modules',
'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/dagomez/.ansible/collections:/usr
/share/ansible/collections
executable location = /usr/bin/ansible-playbook
python version = 3.13.3 (main, Apr 10 2025, 21:38:51) [GCC 14.2.0]
(/usr/bin/python3)
jinja version = 3.1.6
pyyaml version = 6.0.2 (with libyaml v0.2.5)
Using /scratch/dagomez/linux-kdevops/kdevops/ansible.cfg as config file statically imported:
/scratch/dagomez/linux-kdevops/kdevops/playbooks/roles/guestfs/tasks/ install-deps/main.yml
[ERROR]: Unable to retrieve file contents.
Could not find or access
'/scratch/dagomez/linux-kdevops/kdevops/playbooks/debian/main.yml' on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option: [Errno 2] No such file or directory: '/scratch/dagomez/linux-kdevops/kdevops/playbooks/debian/main.yml