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
|
- cluster.k3s.yml
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: Initialize tempfile
|
- block:
|
||||||
ansible.builtin.tempfile:
|
|
||||||
state: file
|
|
||||||
register: kubeconfig
|
|
||||||
|
|
||||||
- name: Store kubeconfig in tempfile
|
- name: Initialize tempfile
|
||||||
ansible.builtin.copy:
|
ansible.builtin.tempfile:
|
||||||
dest: "{{ kubeconfig.path }}"
|
state: file
|
||||||
content: "{{ ( lookup('dict', hostvars) )[0].value.cluster.kubeconfig }}"
|
register: kubeconfig
|
||||||
mode: 0600
|
|
||||||
|
|
||||||
- name: Replace API url
|
- name: Store kubeconfig in tempfile
|
||||||
ansible.builtin.replace:
|
ansible.builtin.copy:
|
||||||
path: "{{ kubeconfig.path }}"
|
dest: "{{ kubeconfig.path }}"
|
||||||
regexp: 'server: https:\/\/127\.0\.0\.1:6443$'
|
content: "{{ ( lookup('dict', hostvars) )[0].value.cluster.kubeconfig }}"
|
||||||
replace: "server: https://{{ cluster.virtualip | ansible.utils.ipaddr('address') }}:6443"
|
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
|
- name: Add Helm chart repositories
|
||||||
kubernetes.core.helm_repository:
|
kubernetes.core.helm_repository:
|
||||||
@ -221,7 +223,7 @@
|
|||||||
create_namespace: yes
|
create_namespace: yes
|
||||||
wait: yes
|
wait: yes
|
||||||
kubeconfig: "{{ kubeconfig.path }}"
|
kubeconfig: "{{ kubeconfig.path }}"
|
||||||
values: "{{ item.values | default('omit', true) }}"
|
values: "{{ item.values | default({}) }}"
|
||||||
loop:
|
loop:
|
||||||
- name: cert-manager
|
- name: cert-manager
|
||||||
ref: jetstack/cert-manager
|
ref: jetstack/cert-manager
|
||||||
|
Loading…
Reference in New Issue
Block a user