forked from tim/k3s-ansible
fix(ansible): update fact references to remove deprecation warnings (#715)
* chore(ansible): use ansible_facts * fix(ansible): satisfy lint for fact migration - wrap nested fact expressions to meet YAML line length limits - update the bootstrap regression assertion for ansible_facts * fix(pre-commit): install shellcheck for host architecture - install shellcheck-py from PyPI in the local hook environment - pin the platform-aware shellcheck package version --------- Co-authored-by: Timothy Stewart <timothystewart6@gmail.com>
This commit is contained in:
1 parent
ee3a4a126e
commit
8fb1e26c63
15 files changed
+68
-49
No files matched your search
@@ -6,7 +6,8 @@
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']
|
||||
when: >-
|
||||
ansible_facts.hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_facts']['hostname']
|
||||
|
||||
- name: "Download to first master: manifest for metallb-{{ metal_lb_type }}"
|
||||
ansible.builtin.get_url:
|
||||
@@ -19,7 +20,8 @@
|
||||
retries: "{{ download_retries }}"
|
||||
delay: "{{ download_delay }}"
|
||||
until: metallb_manifest_download is succeeded
|
||||
when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']
|
||||
when: >-
|
||||
ansible_facts.hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_facts']['hostname']
|
||||
|
||||
- name: Set image versions in manifest for metallb-{{ metal_lb_type }}
|
||||
ansible.builtin.replace:
|
||||
@@ -31,13 +33,15 @@
|
||||
to: metallb/speaker:{{ metal_lb_speaker_tag_version }}
|
||||
loop_control:
|
||||
label: "{{ item.change }} => {{ item.to }}"
|
||||
when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']
|
||||
when: >-
|
||||
ansible_facts.hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_facts']['hostname']
|
||||
|
||||
- name: Read back MetalLB manifest from first master
|
||||
ansible.builtin.slurp:
|
||||
src: /var/lib/rancher/k3s/server/manifests/metallb-crds.yaml
|
||||
register: metallb_manifest
|
||||
when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']
|
||||
when: >-
|
||||
ansible_facts.hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_facts']['hostname']
|
||||
|
||||
- name: Check the MetalLB speaker image reference is present
|
||||
ansible.builtin.set_fact:
|
||||
@@ -46,7 +50,8 @@
|
||||
('quay.io/metallb/speaker:' ~ metal_lb_speaker_tag_version) in
|
||||
(metallb_manifest.content | default('') | b64decode)
|
||||
}}
|
||||
when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']
|
||||
when: >-
|
||||
ansible_facts.hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_facts']['hostname']
|
||||
|
||||
- name: Fail if MetalLB speaker tag was not applied to the manifest
|
||||
ansible.builtin.fail:
|
||||
@@ -56,5 +61,6 @@
|
||||
was not found in the downloaded manifest. The upstream image
|
||||
reference may have changed.
|
||||
when:
|
||||
- ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']
|
||||
- >-
|
||||
ansible_facts.hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_facts']['hostname']
|
||||
- not metallb_manifest_has_speaker_tag
|
||||
Reference in new issue
Block a user