From 2f937aded7c9f6b4a3690a5a4b018ed86916266c Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sun, 3 Jul 2022 14:52:01 +0200 Subject: [PATCH] Rename vapp property;Configure node for private registry --- .../roles/metacluster/tasks/main.yml | 13 +++++++++---- ansible/roles/firstboot/templates/registries.j2 | 6 ++++++ scripts/Update-OvfConfiguration.yml | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 ansible/roles/firstboot/templates/registries.j2 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 0814236..3062497 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 @@ -69,7 +69,7 @@ defaultReplicaCount: 1 ingress: enabled: true - host: storage.{{ vapp['guestinfo.fqdn'] }} + host: storage.{{ vapp['metacluster.fqdn'] }} persistence: defaultClassReplicaCount: 1 @@ -85,8 +85,8 @@ expose: ingress: hosts: - core: registry.{{ vapp['guestinfo.fqdn'] }} - externalURL: https://registry.{{ vapp['guestinfo.fqdn'] }} + core: registry.{{ vapp['metacluster.fqdn'] }} + externalURL: https://registry.{{ vapp['metacluster.fqdn'] }} harborAdminPassword: "{{ vapp['guestinfo.rootpw'] }}" notary: enabled: false @@ -98,7 +98,7 @@ --dest-tls-verify=false \ --dest-creds admin:{{ vapp['guestinfo.rootpw'] }} \ docker-archive:./{{ item }} \ - docker://registry.{{ vapp['guestinfo.fqdn'] }}/library/$( \ + docker://registry.{{ vapp['metacluster.fqdn'] }}/library/$( \ k3s ctr run \ --rm \ --mount type=bind,src=$PWD,dst=/data,options=rbind:ro \ @@ -118,6 +118,11 @@ path: /opt/metacluster/container-images state: absent +- name: Configure K3s node for private registry + ansible.builtin.template: + dest: /etc/rancher/k3s/registries.yaml + src: registries.j2 + - name: Cleanup tempfile ansible.builtin.file: path: "{{ kubeconfig.path }}" diff --git a/ansible/roles/firstboot/templates/registries.j2 b/ansible/roles/firstboot/templates/registries.j2 new file mode 100644 index 0000000..dde339c --- /dev/null +++ b/ansible/roles/firstboot/templates/registries.j2 @@ -0,0 +1,6 @@ +mirrors: + docker.io: + endpoint: + - "https://registry.{{ vapp['metacluster.fqdn'] }} + rewrite: + "(.*)": "library/docker.io/$1" diff --git a/scripts/Update-OvfConfiguration.yml b/scripts/Update-OvfConfiguration.yml index c4232de..49ababf 100644 --- a/scripts/Update-OvfConfiguration.yml +++ b/scripts/Update-OvfConfiguration.yml @@ -35,7 +35,7 @@ PropertyCategories: - Name: 1) Kubernetes ProductProperties: - - Key: guestinfo.fqdn + - Key: metacluster.fqdn Type: string(1..) Label: Appliance FQDN* Description: 'Respective subdomains will be available for each component (e.g. storage.example.org); this address should already be configured as a wildcard record within your DNS zone.'