-
Notifications
You must be signed in to change notification settings - Fork 67
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
Comments
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 |
These are typically defined in Do you have a use case where you need to use |
Am 3. August 2022 15:41:10 MESZ schrieb Richard Megginson ***@***.***>:
> Section [3.1.9.1. Platform specific variables](https://redhat-cop.github.io/automation-good-practices/#_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.
I got some help on this and have put it into `vars/main.yml`.
Do you have a use case where you need to use `ANSIBLE_GATHERING=explicit` or `gather_facts: false` in your playbooks?
Speaking for myself: No. I see this as some sort of failsave, so the role would work when used by someone else, who might have set `gather_facts: false`.
|
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.
The text was updated successfully, but these errors were encountered: