support gather_facts: false; support setup-snapshot.yml#79
Conversation
Some users use `gather_facts: false` in their playbooks. This changes the role to work in that case, by gathering only the facts it requires to run. CI testing can be sped up by creating a snapshot image pre-installed with packages. tests/setup-snapshot.yml can be used by a CI system to do this.
| - "{{ ansible_facts['os_family'] }}.yml" | ||
| - "default.yml" | ||
| paths: | ||
| - "{{ role_path }}/vars" |
There was a problem hiding this comment.
Out of curiosity, why you don't use loop and __vars_file here as you usually do in the other set_vars.yml like this?
https://github.com/linux-system-roles/certificate/blob/master/tasks/set_vars.yml#L8-L21
There was a problem hiding this comment.
With the certificate role, it was safe to convert the first_found method to the "is file" method - every parameter is correctly set or overridden. For other roles, it didn't seem safe, so I didn't convert. I probably should not have converted certificate like this - it is not related to the PR - I thought it would simplify porting the change to other roles - but other roles are not so simple.
There was a problem hiding this comment.
In the case of the kernel_settings role, it is safe to convert the first_found method to the "is file" method - but I think we should not make this change in order to support gather_facts: false and setup-snapshot.yml
There was a problem hiding this comment.
Thanks for the details, @richm. I am currently working on timesync which shares the same issue. I'm not going to convert it to loop, then. Thanks!
Some users use
gather_facts: falsein their playbooks. This changesthe role to work in that case, by gathering only the facts it requires
to run.
CI testing can be sped up by creating a snapshot image pre-installed
with packages. tests/setup-snapshot.yml can be used by a CI system
to do this.