From 35b3d5d3b9d37c9584cc7c23c1391479bc0e2110 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sun, 28 Aug 2022 09:07:17 +0200 Subject: [PATCH] Refine task order w/ tags;Fix API check --- .../roles/metacluster/tasks/certauthority.yml | 7 +++++++ .../roles/metacluster/tasks/git.yml | 14 +++++--------- .../roles/metacluster/tasks/gitops.yml | 12 +++++------- .../roles/metacluster/tasks/k3s.yml | 12 +++++------- .../roles/metacluster/tasks/main.yml | 3 +++ 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/certauthority.yml b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/certauthority.yml index 4dabfbc..d8bbc73 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/certauthority.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/certauthority.yml @@ -34,6 +34,10 @@ - argo-cd - kube-system + tags: + - never + - final + - name: Configure step-ca passthrough ingress ansible.builtin.template: src: ingressroutetcp.j2 @@ -70,6 +74,9 @@ - name: LEGO_CA_CERTIFICATES value: /step-ca/root_ca.crt marker: ' # {mark} ANSIBLE MANAGED BLOCK' + tags: + - never + - final notify: - Apply manifests diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/git.yml b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/git.yml index 8a349f9..615a062 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/git.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/git.yml @@ -36,15 +36,11 @@ ansible.builtin.meta: flush_handlers - name: Ensure gitea API availability - ansible.utils.cli_parse: - # Available from Gitea 1.17.x - # command: curl -k https://git.{{ vapp['metacluster.fqdn'] }}/api/healtz - command: curl -k https://git.{{ vapp['metacluster.fqdn'] }}/api/v1/version - parser: - name: ansible.utils.json - set_fact: api_readycheck - ignore_errors: - until: api_readycheck.version is defined + ansible.builtin.uri: + url: https://git.{{ vapp['metacluster.fqdn'] }}/api/healtz + method: GET + register: api_readycheck + until: api_readycheck.json.status | default(false) | bool retries: 3 delay: 30 diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/gitops.yml b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/gitops.yml index da6fecf..421e046 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/gitops.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/gitops.yml @@ -11,13 +11,11 @@ values: "{{ components.argocd.chart_values }}" - name: Ensure argo-cd API availability - ansible.utils.cli_parse: - command: curl -k https://gitops.{{ vapp['metacluster.fqdn'] }}/api/version - parser: - name: ansible.utils.json - set_fact: api_readycheck - ignore_errors: - until: api_readycheck.Version is defined + ansible.builtin.uri: + url: https://gitops.{{ vapp['metacluster.fqdn'] }}/api/version + method: GET + register: api_readycheck + until: api_readycheck.json.Version | default(false) | bool retries: 3 delay: 30 diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/k3s.yml b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/k3s.yml index ae8ec25..2ffcff2 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/k3s.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/k3s.yml @@ -12,13 +12,11 @@ when: ansible_facts.services['k3s.service'] is undefined - name: Ensure API availability - ansible.utils.cli_parse: - command: curl -k https://{{ vapp['guestinfo.ipaddress'] }}:6443/livez?verbose - parser: - name: ansible.utils.json - set_fact: api_readycheck - ignore_errors: yes - until: api_readycheck.apiVersion is defined + ansible.builtin.uri: + url: https://{{ vapp['guestinfo.ipaddress'] }}:6443/livez?verbose + method: GET + register: api_readycheck + until: api_readycheck.json.apiVersion | default(false) | bool retries: 3 delay: 30 diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml index fb8ba07..0e74e6c 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/metacluster/tasks/main.yml @@ -6,4 +6,7 @@ - import_tasks: registry.yml - import_tasks: git.yml - import_tasks: gitops.yml + +- import_tasks: certauthority.yml + tags: final - import_tasks: cleanup.yml