prole/infrastructure/roles/k3s/tasks/svc_check.yml

55 lines
1.7 KiB
YAML

---
# Deploy a tiny static check site and route it through Kong as svc.prole.org
- name: Read prole type gif (controller)
ansible.builtin.slurp:
src: "{{ playbook_dir }}/../../img/prole-type.gif"
register: svc_check_gif
delegate_to: localhost
become: false
run_once: true
- name: Render svc-check Helm chart
ansible.builtin.command:
argv:
- helm
- template
- svc-check
- "{{ playbook_dir }}/../../infrastructure/deployments/svc-check-helm"
- --namespace
- "{{ k3s_svc_check_namespace }}"
- --set-string
- "svcCheck.domain={{ k3s_svc_check_domain }}"
- --set-string
- "svcCheck.gifB64={{ svc_check_gif.content | trim }}"
- --set-string
- "kong.namespace={{ k3s_svc_check_kong_namespace }}"
- --set-string
- "kong.configMapName={{ k3s_svc_check_kong_configmap_name }}"
- --set-string
- "ingress.clusterIssuer=letsencrypt-prod"
register: svc_check_manifest
delegate_to: localhost
become: false
changed_when: false
run_once: true
- name: Apply svc-check manifest
ansible.builtin.command: k3s kubectl apply -f -
args:
stdin: "{{ svc_check_manifest.stdout }}"
register: svc_check_apply
changed_when: "'configured' in svc_check_apply.stdout or 'created' in svc_check_apply.stdout"
run_once: true
- name: Detect whether Kong declarative config changed
ansible.builtin.set_fact:
svc_check_kong_config_changed: >-
{{ (svc_check_apply.stdout_lines
| select('search', '^configmap/' ~ k3s_svc_check_kong_configmap_name ~ ' ')
| select('search', '(configured|created)$')
| list
| length) > 0 }}
when: svc_check_apply is defined
run_once: true