Simplify loop with optional dict
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
27e6fb0b92
commit
bcb0f0f164
32
playbook.yml
32
playbook.yml
@ -181,22 +181,24 @@
|
||||
- cluster.k3s.yml
|
||||
tasks:
|
||||
|
||||
- name: Initialize tempfile
|
||||
ansible.builtin.tempfile:
|
||||
state: file
|
||||
register: kubeconfig
|
||||
- block:
|
||||
|
||||
- name: Store kubeconfig in tempfile
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ kubeconfig.path }}"
|
||||
content: "{{ ( lookup('dict', hostvars) )[0].value.cluster.kubeconfig }}"
|
||||
mode: 0600
|
||||
- name: Initialize tempfile
|
||||
ansible.builtin.tempfile:
|
||||
state: file
|
||||
register: kubeconfig
|
||||
|
||||
- name: Replace API url
|
||||
ansible.builtin.replace:
|
||||
path: "{{ kubeconfig.path }}"
|
||||
regexp: 'server: https:\/\/127\.0\.0\.1:6443$'
|
||||
replace: "server: https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443"
|
||||
- name: Store kubeconfig in tempfile
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ kubeconfig.path }}"
|
||||
content: "{{ ( lookup('dict', hostvars) )[0].value.cluster.kubeconfig }}"
|
||||
mode: 0600
|
||||
|
||||
- name: Replace API url
|
||||
ansible.builtin.replace:
|
||||
path: "{{ kubeconfig.path }}"
|
||||
regexp: 'server: https:\/\/127\.0\.0\.1:6443$'
|
||||
replace: "server: https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443"
|
||||
|
||||
- name: Add Helm chart repositories
|
||||
kubernetes.core.helm_repository:
|
||||
@ -221,7 +223,7 @@
|
||||
create_namespace: yes
|
||||
wait: yes
|
||||
kubeconfig: "{{ kubeconfig.path }}"
|
||||
values: "{{ item.values | default('omit', true) }}"
|
||||
values: "{{ item.values | default({}) }}"
|
||||
loop:
|
||||
- name: cert-manager
|
||||
ref: jetstack/cert-manager
|
||||
|
Loading…
Reference in New Issue
Block a user