From fa0b72a9038338ca65c1c352f4db248a8f92d0f8 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Sat, 25 Mar 2023 16:58:23 +0100 Subject: [PATCH] Remove git repo logic; Debug ova templates --- ansible/playbook.yml | 1 + ansible/roles/assets/tasks/git.yml | 5 ----- ansible/roles/assets/tasks/main.yml | 4 ++-- ansible/roles/assets/tasks/nodetemplates.yml | 2 +- .../roles/workloadcluster/tasks/nodetemplates.yml | 11 ++++++++--- .../common/roles/disks/tasks/main.yml | 4 ++++ .../roles/workloadcluster/tasks/nodetemplates.yml | 6 +++--- ansible/vars/metacluster.yml | 12 ++++++------ ansible/vars/workloadcluster.yml | 15 +++++++++++++++ 9 files changed, 40 insertions(+), 20 deletions(-) delete mode 100644 ansible/roles/assets/tasks/git.yml create mode 100644 ansible/vars/workloadcluster.yml diff --git a/ansible/playbook.yml b/ansible/playbook.yml index d0763e8..4939995 100644 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -3,6 +3,7 @@ gather_facts: false vars_files: - metacluster.yml + - workloadcluster.yml become: true roles: - os diff --git a/ansible/roles/assets/tasks/git.yml b/ansible/roles/assets/tasks/git.yml deleted file mode 100644 index f4d2f8f..0000000 --- a/ansible/roles/assets/tasks/git.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Clone git repository - ansible.builtin.git: - repo: "{{ platform.gitops.repository.uri }}" - version: "{{ platform.gitops.repository.revision }}" - dest: /opt/metacluster/git-repositories/gitops diff --git a/ansible/roles/assets/tasks/main.yml b/ansible/roles/assets/tasks/main.yml index d565b5c..13d7529 100644 --- a/ansible/roles/assets/tasks/main.yml +++ b/ansible/roles/assets/tasks/main.yml @@ -12,11 +12,11 @@ - /opt/metacluster/cluster-api/infrastructure-vsphere/{{ components.clusterapi.management.version.infrastructure_vsphere }} - /opt/metacluster/cluster-api/ipam-in-cluster/{{ components.clusterapi.management.version.ipam_incluster }} - /opt/metacluster/container-images - - /opt/metacluster/git-repositories/gitops + - /opt/metacluster/git-repositories - /opt/metacluster/helm-charts - /opt/metacluster/k3s - /opt/metacluster/kube-vip - - /opt/workloadcluster/node-templates + - /opt/metacluster/node-templates - /var/lib/rancher/k3s/agent/images - /var/lib/rancher/k3s/server/manifests diff --git a/ansible/roles/assets/tasks/nodetemplates.yml b/ansible/roles/assets/tasks/nodetemplates.yml index eb7b93c..52104f2 100644 --- a/ansible/roles/assets/tasks/nodetemplates.yml +++ b/ansible/roles/assets/tasks/nodetemplates.yml @@ -1,4 +1,4 @@ - name: Download node-template image ansible.builtin.uri: url: "{{ components.clusterapi.workload.node_template.url }}" - dest: /opt/workloadcluster/node-templates/{{ components.clusterapi.workload.node_template.url | basename}} + dest: /opt/metacluster/node-templates/{{ components.clusterapi.workload.node_template.url | basename}} diff --git a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/nodetemplates.yml b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/nodetemplates.yml index fa0545c..4674ca2 100644 --- a/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/nodetemplates.yml +++ b/ansible/roles/firstboot/files/ansible_payload/bootstrap/roles/workloadcluster/tasks/nodetemplates.yml @@ -4,7 +4,7 @@ community.vmware.vmware_guest_info: name: "{{ (item | basename | split('.'))[:-1] | join('.') }}" register: existing_ova - loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | sort }}" + loop: "{{ query('ansible.builtin.fileglob', '/opt/metacluster/node-templates/*.ova') | first }}" ignore_errors: yes - name: Parse OVA files for network mappings @@ -17,7 +17,7 @@ GOVC_PASSWORD: "{{ vapp['hv.password'] }}" register: ova_spec when: existing_ova.results[index] is failed - loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | sort }}" + loop: "{{ query('ansible.builtin.fileglob', '/opt/metacluster/node-templates/*.ova') | first }}" loop_control: index_var: index @@ -32,10 +32,15 @@ ovf: "{{ item }}" register: ova_deploy when: existing_ova.results[index] is failed - loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | sort }}" + loop: "{{ query('ansible.builtin.fileglob', '/opt/metacluster/node-templates/*.ova') | first }}" loop_control: index_var: index + - debug: + msg: "{{ existing_ova.results | first }}" + - debug: + msg: "{{ ova_deploy.results | first }}" + - name: Add additional placeholder disk community.vmware.vmware_guest_disk: name: "{{ item.instance.hw_name }}" diff --git a/ansible/roles/firstboot/files/ansible_payload/common/roles/disks/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/common/roles/disks/tasks/main.yml index c74bcec..62b80ef 100644 --- a/ansible/roles/firstboot/files/ansible_payload/common/roles/disks/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/common/roles/disks/tasks/main.yml @@ -28,6 +28,10 @@ ansible.builtin.set_fact: storage_benchmark: "{{ [storage_benchmark, (end_time | int - start_time | int)] | max }}" +- name: Log benchmark actual duration + ansible.builtin.debug: + msg: "Benchmark actual duration: {{ (end_time | int - start_time | int) }} second(s)" + - name: Mount dynamic disk ansible.posix.mount: path: /mnt/blockstorage diff --git a/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/workloadcluster/tasks/nodetemplates.yml b/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/workloadcluster/tasks/nodetemplates.yml index 2060474..38ab4ea 100644 --- a/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/workloadcluster/tasks/nodetemplates.yml +++ b/ansible/roles/firstboot/files/ansible_payload/upgrade/roles/workloadcluster/tasks/nodetemplates.yml @@ -4,7 +4,7 @@ community.vmware.vmware_guest_info: name: "{{ (item | basename | split('.'))[:-1] | join('.') }}" register: existing_ova - loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | sort }}" + loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | first }}" ignore_errors: yes - name: Parse OVA files for network mappings @@ -17,7 +17,7 @@ GOVC_PASSWORD: "{{ vapp['hv.password'] }}" register: ova_spec when: existing_ova.results[index] is failed - loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | sort }}" + loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | first }}" loop_control: index_var: index @@ -33,7 +33,7 @@ ovf: "{{ item }}" register: ova_deploy when: existing_ova.results[index] is failed - loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | sort }}" + loop: "{{ query('ansible.builtin.fileglob', '/opt/workloadcluster/node-templates/*.ova') | first }}" loop_control: index_var: index diff --git a/ansible/vars/metacluster.yml b/ansible/vars/metacluster.yml index b5b1e90..e9b7a0f 100644 --- a/ansible/vars/metacluster.yml +++ b/ansible/vars/metacluster.yml @@ -3,11 +3,11 @@ platform: k3s: version: v1.26.2+k3s1 - gitops: - repository: - uri: https://code.spamasaurus.com/djpbessems/GitOps.MetaCluster.git - # revision: v0.1.0 - revision: HEAD + # gitops: + # repository: + # uri: https://code.spamasaurus.com/djpbessems/GitOps.MetaCluster.git + # # revision: v0.1.0 + # revision: HEAD packaged_components: - name: traefik @@ -216,7 +216,7 @@ components: longhorn: helm: - version: 1.4.0 + version: 1.4.1 chart: longhorn/longhorn parse_logic: cat values.yaml | yq eval '.. | select(has("repository")) | .repository + ":" + .tag' chart_values: !unsafe | diff --git a/ansible/vars/workloadcluster.yml b/ansible/vars/workloadcluster.yml new file mode 100644 index 0000000..ae82752 --- /dev/null +++ b/ansible/vars/workloadcluster.yml @@ -0,0 +1,15 @@ +downstream: + + helm_repositories: + - name: longhorn + url: https://charts.longhorn.io + + helm_charts: + + longhorn: + version: 1.4.1 + chart: longhorn/longhorn + parse_logic: cat values.yaml | yq eval '.. | select(has("repository")) | .repository + ":" + .tag' + chart_values: !unsafe | + defaultSettings: + defaultDataPath: /mnt/blockstorage