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

Decision on how to handle fact gathering in a role #58

Open
ericzolf opened this issue Mar 24, 2022 · 3 comments
Open

Decision on how to handle fact gathering in a role #58

ericzolf opened this issue Mar 24, 2022 · 3 comments

Comments

@ericzolf
Copy link
Contributor

the system roles team recently had a request to be able to run roles when the user has done gather_facts: false in the playbook - what would we recommend? Only document, gather if not yet done, let it fail...

See https://chat.google.com/room/AAAAarh_G-k/LvyYgMPd0-E for details.

@Tronde
Copy link

Tronde commented Aug 3, 2022

Section 3.1.9.1. Platform specific variables seems to cover this topic.

But I have some trouble following the example given there. I don't understand where and how to define a list of required facts for __rolename_required_facts. So my playbook fails with the error '__rolename_required_facts' is undefined.

@richm
Copy link
Contributor

richm commented Aug 3, 2022

Section 3.1.9.1. Platform specific variables seems to cover this topic.

But I have some trouble following the example given there. I don't understand where and how to define a list of required facts for __rolename_required_facts. So my playbook fails with the error '__rolename_required_facts' is undefined.

These are typically defined in vars/main.yml - most of the system roles use this e.g. https://github.com/linux-system-roles/storage/blob/master/vars/main.yml - in some cases where the role was not using vars/ the facts are defined in defaults/main.yml - https://github.com/linux-system-roles/network/blob/main/defaults/main.yml#L125 - as long as they are defined by the time ansible executes tasks/main.yml of the role.

Do you have a use case where you need to use ANSIBLE_GATHERING=explicit or gather_facts: false in your playbooks?

@Tronde
Copy link

Tronde commented Aug 3, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants