Replace injected Ansible fact variables in network_facts and system_packages role#13324
Replace injected Ansible fact variables in network_facts and system_packages role#13324wt wants to merge 1 commit into
Conversation
|
Hi @wt. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Related #13208 /ok-to-test |
|
/remove-kind bug |
|
/retitle Replace injected Ansible fact variables in network_facts and system_packages role |
72d1e42 to
7a10466
Compare
69bd0c4 to
541bc70
Compare
2adceb3 to
f622e71
Compare
66efc7e to
ad7c8f6
Compare
|
Assuming the tests all pass. I think this one is ready to go. |
There was a problem hiding this comment.
Pull request overview
This PR updates Kubespray’s network_facts and system_packages roles to avoid deprecated “inject facts as vars” usage by switching from injected ansible_* fact variables (e.g., ansible_os_family) to ansible_facts[...] access, in line with Ansible’s porting guidance.
Changes:
- Replace injected OS/distribution/package-manager fact variables with
ansible_facts[...]insystem_packages. - Update
network_factsto gather and reference network facts viaansible_factsinstead of injectedansible_default_*variables. - Adjust
network_factshostname extraction logic forno_proxypreparation (currently has a functional regression).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| roles/system_packages/vars/main.yml | Switch package condition predicates from injected fact vars to ansible_facts[...]. |
| roles/system_packages/tasks/main.yml | Use ansible_facts[...] for pkg manager / OS checks and package cache behavior. |
| roles/network_facts/tasks/main.yaml | Use ansible_facts for default IP facts and update fact-gathering filter; modifies no_proxy hostname aggregation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I have converted this back to a draft to experiment with just enabling the |
8c24637 to
c7ec84d
Compare
The old way of injecting facts as variables is deprecated. Switching to the new way. roles updated: * network_facts * system_packages
|
Can someone please check this one to see if it's ready for lgtm/approve? |
tico88612
left a comment
There was a problem hiding this comment.
one more question, but nit.
otherwise LGTM
| filter: "ansible_default_ip*" | ||
| when: ansible_default_ipv4 is not defined or ansible_default_ipv6 is not defined | ||
| filter: "default_ip*" | ||
| when: "ansible_facts is not defined or 'default_ipv4' not in ansible_facts or 'default_ipv6' not in ansible_facts" |
There was a problem hiding this comment.
Do we need ansible_facts is not defined here?
Under what circumstances would ansible_facts be undefined?
The old way of injecting facts as variables is deprecated. Switching to the new way.
roles updated:
/kind bug
Special notes for your reviewer:
Injecting facts as vars is deprecated. See here.
Just so you know, I am using a local branch modified to allow the use of ansible 2.20. These changes should be backward compatible with 2.18/19, which are the currently supported versions of ansible for kubespray.
Does this PR introduce a user-facing change?