Sort fileglob loops;Fix filter parameter;Remove redundant key;Fix multiline key/value pairs;Add helm-adopt labels
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2022-09-04 14:51:07 +02:00
parent 1141225907
commit 7b17b8ad63
8 changed files with 13 additions and 10 deletions

View File

@ -20,5 +20,5 @@
src: "{{ item }}"
state: present
kubeconfig: "{{ kubeconfig.path }}"
with_fileglob: /var/lib/rancher/k3s/server/manifests/*.yaml
loop: "{{ query('ansible.builtin.fileglob', '/var/lib/rancher/k3s/server/manifests/*.yaml') | sort }}"
ignore_errors: yes

View File

@ -2,4 +2,4 @@
ansible.builtin.command:
cmd: k3s ctr image import {{ item }}
chdir: /opt/metacluster/container-images
with_fileglob: /opt/metacluster/container-images/*.tar
loop: "{{ query('ansible.builtin.fileglob', '/opt/metacluster/container-images/*.tar') | sort }}"

View File

@ -35,15 +35,18 @@
_template:
name: "{{ item.name }}"
namespace: "{{ item.namespace }}"
labels: "{{ item.labels | default({}) | indent(width=4, indent=True) }}"
labels: "{{ item.labels | default('{}') | indent(width=4, first=True) }}"
data: "{{ item.data }}"
loop:
- name: argocd-tls-certs-cm
namespace: argo-cd
kind: configmap
labels: |
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
meta.helm.sh/release-name: argo-cd
meta.helm.sh/release-namespace: argo-cd
data:
- key: git.{{ vapp['metacluster.fqdn'] }}
value: "{{ stepca_cm_certs.resources[0].data['root_ca.crt'] }}"

View File

@ -1,4 +1,4 @@
- name: Create component entries in /etc/hosts
- name: Configure fallback name resolution
ansible.builtin.lineinfile:
path: /etc/hosts
line: "{{ vapp['guestinfo.ipaddress'] }} {{ item + '.' + vapp['metacluster.fqdn'] }}"

View File

@ -22,7 +22,7 @@
docker-archive:./{{ item | basename }} | \
jq -r '.Tags[0]')
chdir: /opt/metacluster/container-images/
with_fileglob: /opt/metacluster/container-images/*.tar
loop: "{{ query('ansible.builtin.fileglob', '/opt/metacluster/container-images/*.tar') | sort }}"
loop_control:
label: "{{ item | basename }}"

View File

@ -5,7 +5,7 @@
release_namespace: kube-system
wait: yes
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.sealedsecrets.chart_values }}"
# values: "{{ components.sealedsecrets.chart_values }}"
- name: Store hypervisor details in secret
kubernetes.core.k8s:

View File

@ -54,7 +54,7 @@
community.vmware.vmware_guest_info:
name: "{{ (item | basename | split('.'))[:-1] | join('.') }}"
register: existing_ova
with_fileglob: /opt/workloadcluster/node-templates/*.ova
loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | sort }}"
ignore_errors: yes
- name: Parse OVA files for network mappings
@ -67,7 +67,7 @@
GOVC_PASSWORD: "{{ vapp['hv.password'] }}"
register: ova_spec
when: existing_ova.results[index] is failed
with_fileglob: /opt/workloadcluster/node-templates/*.ova
loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | sort }}"
loop_control:
index_var: index
@ -83,7 +83,7 @@
ovf: "{{ item }}"
register: ova_deploy
when: existing_ova.results[index] is failed
with_fileglob: /opt/workloadcluster/node-templates/*.ova
loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | sort }}"
loop_control:
index_var: index

View File

@ -7,5 +7,5 @@ metadata:
{{ _template.labels }}
data:
{% for kv_pair in _template.data %}
"{{ kv_pair.key }}": {{ kv_pair.value }}
"{{ kv_pair.key }}": "{{ kv_pair.value }}"
{% endfor %}