From ca51303602d7f4ea150e8f0b0cb3831d2b6242d2 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sun, 22 Jan 2023 15:08:12 +0100 Subject: [PATCH] Change ImagePullPolicy;Update tty console message;Sanitize user input;Add missing vapp property --- .../bootstrap/roles/metacluster/tasks/k3s.yml | 2 +- .../bootstrap/roles/metacluster/tasks/kube-vip.yml | 2 +- .../common/roles/tty/tasks/main.yml | 3 +++ .../files/ansible_payload/common/templates/tty.j2 | 6 +++--- .../upgrade/roles/metacluster/tasks/k3s.yml | 2 +- scripts/Update-OvfConfiguration.upgrade.yml | 14 +++++++++++--- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/k3s.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/k3s.yml index 05a55a3..45dd9da 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/k3s.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/k3s.yml @@ -27,7 +27,7 @@ chdir: /opt/metacluster/k3s environment: INSTALL_K3S_SKIP_DOWNLOAD: 'true' - INSTALL_K3S_EXEC: "server --cluster-init --token {{ vapp['metacluster.token'] }} --tls-san {{ vapp['metacluster.vip'] }} --disable local-storage --config /etc/rancher/k3s/config.yaml" + INSTALL_K3S_EXEC: "server --cluster-init --token {{ vapp['metacluster.token'] | trim }} --tls-san {{ vapp['metacluster.vip'] }} --disable local-storage --config /etc/rancher/k3s/config.yaml" when: ansible_facts.services['k3s.service'] is undefined - name: Debug possible taints on k3s node diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/kube-vip.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/kube-vip.yml index 329942e..1be708a 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/kube-vip.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/metacluster/tasks/kube-vip.yml @@ -19,7 +19,7 @@ content: | {{ lookup('ansible.builtin.file', '/opt/metacluster/kube-vip/rbac.yaml') }} --- - {{ kubevip_manifest.stdout }} + {{ kubevip_manifest.stdout | replace('imagePullPolicy: Always', 'imagePullPolicy: IfNotPresent') }} notify: - Apply manifests diff --git a/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml index cca4d18..81cd533 100644 --- a/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/common/roles/tty/tasks/main.yml @@ -18,6 +18,9 @@ name: ttyConsoleMessage executable: /opt/firstboot/tty.sh workingdir: /tmp/ + metacluster: + fqdn: "{{ vapp['metacluster.fqdn'] }}" + vip: "{{ vapp['metacluster.vip'] }}" loop: - src: tty.j2 dest: "{{ _template.service.executable }}" diff --git a/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 b/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 index 913403b..16f56af 100644 --- a/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 +++ b/ansible/roles/firstboot/files/ansible_payload/common/templates/tty.j2 @@ -13,9 +13,9 @@ LCLR='\033[K' # Clear to end of line PRST='\033[0;0H' # Reset cursor position # COMPONENTS=('ca' 'ingress' 'storage' 'registry' 'git' 'gitops') -COMPONENTS=('ca' 'storage' 'registry' 'git' 'gitops') -FQDN='{{ vapp['metacluster.fqdn'] }}' -IPADDRESS='{{ vapp['guestinfo.ipaddress'] }}' +COMPONENTS=('storage' 'registry' 'git' 'gitops') +FQDN='{{ _template.metacluster.fqdn }}' +IPADDRESS='{{ _template.metacluster.vip }}' I=60 diff --git a/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/k3s.yml b/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/k3s.yml index 50393cd..c0670bf 100644 --- a/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/k3s.yml +++ b/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/metacluster/tasks/k3s.yml @@ -27,7 +27,7 @@ chdir: /opt/metacluster/k3s environment: INSTALL_K3S_SKIP_DOWNLOAD: 'true' - INSTALL_K3S_EXEC: "server --token {{ vapp['metacluster.token'] }} --server https://{{ vapp['metacluster.fqdn'] }}:6443 --disable local-storage --config /etc/rancher/k3s/config.yaml" + INSTALL_K3S_EXEC: "server --token {{ vapp['metacluster.token'] | trim }} --server https://{{ vapp['metacluster.fqdn'] }}:6443 --disable local-storage --config /etc/rancher/k3s/config.yaml" when: ansible_facts.services['k3s.service'] is undefined - name: Ensure API availability diff --git a/scripts/Update-OvfConfiguration.upgrade.yml b/scripts/Update-OvfConfiguration.upgrade.yml index 89dd49f..b059b54 100644 --- a/scripts/Update-OvfConfiguration.upgrade.yml +++ b/scripts/Update-OvfConfiguration.upgrade.yml @@ -12,10 +12,18 @@ PropertyCategories: - Name: 1) Existing meta-cluster ProductProperties: - - Key: metacluster.vip + - Key: metacluster.fqdn Type: string(1..) - Label: Meta-cluster FQDN/IP-address* - Description: The address of the target meta-cluster which this appliance will perform an upgrade on. + Label: Meta-cluster FQDN* + Description: The FQDN of the target meta-cluster which this appliance will perform an upgrade on. + DefaultValue: meta.k8s.cluster + Configurations: '*' + UserConfigurable: true + + - key: metacluster.vip + Type: ip + Label: Meta-cluster virtual IP* + Description: Meta-cluster control plane endpoint virtual IP DefaultValue: '' Configurations: '*' UserConfigurable: true