Skip to content
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

ansible_play_role_names check fails when using Kubespray collection #10432

Closed
RikuXan opened this issue Sep 12, 2023 · 2 comments · Fixed by #10590
Closed

ansible_play_role_names check fails when using Kubespray collection #10432

RikuXan opened this issue Sep 12, 2023 · 2 comments · Fixed by #10590
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@RikuXan
Copy link

RikuXan commented Sep 12, 2023

If I understood the structure correctly, the facts.yml playbook starts with bootstrapping the hosts for Ansible by executing the roles kubespray-defaults and bootstrap-os on the relevant hosts.

Inside the kubespray-defaults role, the gathering of facts is skipped if the bootstrap-os role is contained in the current play's imported roles (to prevent e.g. Ansible connections issues due to an incorrect BIN_DIR and therefore Python interpreter path which is yet to be set correctly inside the bootstrap-os role).

However, when using Kubespray as a collection, the ansible_play_role_names variable which contains the imported, active roles will have the collection name prepended before the role name (e.g. kubernetes_sigs.kubespray.bootstrap-os) and therefore invalidate the mentioned check, possibly leading to errors due to an attempt at gathering facts before the OS-specific configuration is bootstrapped correctly.

While the aforementioned Python interpreter issue can be worked around by setting the path manually, I think it would be a good idea to either adjust the check to also work with absolute (i.e. including the collection name) role references, or somehow force Ansible to always use relative role references (not sure this is possible). I hope my description is sufficient to reproduce the issue even without the usual environment information. I am using Kubespray installed via collection from the master branch.

@RikuXan RikuXan added the kind/bug Categorizes issue or PR as related to a bug. label Sep 12, 2023
@VannTen
Copy link
Contributor

VannTen commented Nov 3, 2023

, I think it would be a good idea to either adjust the check to also work with absolute (i.e. including the collection name)

Does that work when not using kubespray as a collection ?

@RikuXan
Copy link
Author

RikuXan commented Nov 3, 2023

As long as the check is changed in such a way that both variants are handled correctly I see no issue for using kubespray the normal way. Just replacing the check would likely break it though, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants