diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/init.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/init.yml index 43f9067..9e49c64 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/init.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/init.yml @@ -53,3 +53,29 @@ - name: Update certificate truststore ansible.builtin.command: cmd: update-ca-certificates + +- name: Get all stored fully qualified container image names + ansible.builtin.shell: + cmd: >- + skopeo list-tags \ + --insecure-policy \ + docker-archive:./{{ item | basename }} | \ + jq -r '.Tags[0]' + chdir: /opt/metacluster/container-images + register: registry_artifacts + loop: "{{ query('ansible.builtin.fileglob', '/opt/metacluster/container-images/*.tar') }}" + +- name: Get source registries of all artifacts + ansible.builtin.set_fact: + source_registries: "{{ (source_registries | default([]) + [(item | split('/'))[0]]) | unique | sort }}" + loop: "{{ registry_artifacts | json_query('results[*].stdout') | select() }}" + +- name: Configure K3s node for private registry + ansible.builtin.template: + dest: /etc/rancher/k3s/registries.yaml + src: registries.j2 + vars: + _template: + data: "{{ source_registries }}" + hv: + fqdn: "{{ vapp['metacluster.fqdn'] }}" diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/registry.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/registry.yml index 2fb42a0..2abefc8 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/registry.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/registry.yml @@ -43,26 +43,26 @@ delay: "{{ playbook.delays.short }}" until: push_result is not failed - - name: Get all stored container images (=artifacts) - ansible.builtin.uri: - url: https://registry.{{ vapp['metacluster.fqdn'] }}/api/v2.0/search?q=library - method: GET - register: registry_artifacts + # - name: Get all stored container images (=artifacts) + # ansible.builtin.uri: + # url: https://registry.{{ vapp['metacluster.fqdn'] }}/api/v2.0/search?q=library + # method: GET + # register: registry_artifacts - - name: Get source registries of all artifacts - ansible.builtin.set_fact: - source_registries: "{{ (source_registries | default([]) + [(item | split('/'))[1]]) | unique | sort }}" - loop: "{{ registry_artifacts.json.repository | json_query('[*].repository_name') }}" + # - name: Get source registries of all artifacts + # ansible.builtin.set_fact: + # source_registries: "{{ (source_registries | default([]) + [(item | split('/'))[1]]) | unique | sort }}" + # loop: "{{ registry_artifacts.json.repository | json_query('[*].repository_name') }}" - - name: Configure K3s node for private registry - ansible.builtin.template: - dest: /etc/rancher/k3s/registries.yaml - src: registries.j2 - vars: - _template: - data: "{{ source_registries }}" - hv: - fqdn: "{{ vapp['metacluster.fqdn'] }}" + # - name: Configure K3s node for private registry + # ansible.builtin.template: + # dest: /etc/rancher/k3s/registries.yaml + # src: registries.j2 + # vars: + # _template: + # data: "{{ source_registries }}" + # hv: + # fqdn: "{{ vapp['metacluster.fqdn'] }}" module_defaults: ansible.builtin.uri: diff --git a/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/preflight/tasks/metacluster.yml b/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/preflight/tasks/metacluster.yml index dce935d..5e37d56 100644 --- a/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/preflight/tasks/metacluster.yml +++ b/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/preflight/tasks/metacluster.yml @@ -4,3 +4,8 @@ method: GET validate_certs: no status_code: [200, 401] + register: api_readycheck + until: + - api_readycheck.json.apiVersion is defined + retries: "{{ playbook.retries }}" + delay: "{{ playbook.delays.medium }}"