From 8f432d3353284f09665316e601d6838ce02856b4 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Mon, 27 Jun 2022 10:55:17 +0200 Subject: [PATCH] Remove debugging;Housekeeping;Rename dict --- .../files/ansible_payload/roles/network/tasks/main.yml | 4 +++- .../ansible_payload/roles/network/templates/netplan.j2 | 6 +++--- .../files/ansible_payload/roles/users/tasks/main.yml | 4 ++-- .../files/ansible_payload/roles/vapp/tasks/main.yml | 4 ++-- ansible/roles/metacluster/tasks/components.yml | 3 --- ansible/vars/metacluster.yml | 3 --- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/network/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/network/tasks/main.yml index d016d92..1393ce0 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/network/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/network/tasks/main.yml @@ -1,10 +1,12 @@ - name: Set hostname ansible.builtin.hostname: - name: "{{ ovfproperties['guestinfo.hostname'] }}" + name: "{{ vapp['guestinfo.hostname'] }}" + - name: Create netplan configuration file ansible.builtin.template: src: netplan.j2 dest: /etc/netplan/00-installer-config.yaml + - name: Apply netplan configuration ansible.builtin.shell: cmd: /usr/sbin/netplan apply diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/network/templates/netplan.j2 b/ansible/roles/firstboot/files/ansible_payload/roles/network/templates/netplan.j2 index fd8bfe5..7500090 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/network/templates/netplan.j2 +++ b/ansible/roles/firstboot/files/ansible_payload/roles/network/templates/netplan.j2 @@ -3,8 +3,8 @@ network: ethernets: ens192: addresses: - - {{ ovfproperties['guestinfo.ipaddress'] }}/{{ ovfproperties['guestinfo.prefixlength'] }} - gateway4: {{ ovfproperties['guestinfo.gateway'] }} + - {{ vapp['guestinfo.ipaddress'] }}/{{ vapp['guestinfo.prefixlength'] }} + gateway4: {{ vapp['guestinfo.gateway'] }} nameservers: addresses: - - {{ ovfproperties['guestinfo.dnsserver'] }} + - {{ vapp['guestinfo.dnsserver'] }} diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/users/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/users/tasks/main.yml index 92cda5d..77f412f 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/users/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/users/tasks/main.yml @@ -1,14 +1,14 @@ - name: Set root password ansible.builtin.user: name: root - password: "{{ ovfproperties['guestinfo.rootpw'] | password_hash('sha512', 65534 | random(seed=ovfproperties['guestinfo.hostname']) | string) }}" + password: "{{ vapp['guestinfo.rootpw'] | password_hash('sha512', 65534 | random(seed=vapp['guestinfo.hostname']) | string) }}" generate_ssh_key: yes ssh_key_bits: 2048 ssh_key_file: .ssh/id_rsa - name: Save root SSH publickey ansible.builtin.lineinfile: path: /root/.ssh/authorized_keys - line: "{{ ovfproperties['guestinfo.rootsshkey'] }}" + line: "{{ vapp['guestinfo.rootsshkey'] }}" - name: Disable SSH password authentication ansible.builtin.lineinfile: path: /etc/ssh/sshd_config diff --git a/ansible/roles/firstboot/files/ansible_payload/roles/vapp/tasks/main.yml b/ansible/roles/firstboot/files/ansible_payload/roles/vapp/tasks/main.yml index ed6dfe4..803de8e 100644 --- a/ansible/roles/firstboot/files/ansible_payload/roles/vapp/tasks/main.yml +++ b/ansible/roles/firstboot/files/ansible_payload/roles/vapp/tasks/main.yml @@ -12,8 +12,8 @@ register: ovfenv - name: Assign vApp properties to dictionary ansible.builtin.set_fact: - ovfproperties: >- - {{ ovfproperties | default({}) | + vapp: >- + {{ vapp | default({}) | combine({((item.values() | list)[0].values() | list)[0]: ((item.values() | list)[0].values() | list)[1]}) }} diff --git a/ansible/roles/metacluster/tasks/components.yml b/ansible/roles/metacluster/tasks/components.yml index 4372f76..1fd802a 100644 --- a/ansible/roles/metacluster/tasks/components.yml +++ b/ansible/roles/metacluster/tasks/components.yml @@ -30,9 +30,6 @@ loop_control: label: "{{ item.key }}" -- ansible.builtin.debug: - var: containerimages - - name: Pull and store containerimages ansible.builtin.command: cmd: skopeo copy docker://{{ item }} docker-archive:./{{ ( item | regex_findall('[^/:]+'))[-2] }}.tar:{{ item }} diff --git a/ansible/vars/metacluster.yml b/ansible/vars/metacluster.yml index a9d24fd..9c3f406 100644 --- a/ansible/vars/metacluster.yml +++ b/ansible/vars/metacluster.yml @@ -17,19 +17,16 @@ components: helm: version: 1.3.0 chart: longhorn/longhorn - parse_logic: yq e '.. | select(has("repository")) | .repository + ":" + .tag' harbor: helm: version: 1.9.1 # (= Harbor v2.5.1) chart: harbor/harbor - parse_logic: yq e '.. | select(has("repository")) | .repository + ":" + .tag' argo-cd: helm: version: 4.9.7 # (= ArgoCD v2.4.2) chart: argo/argo-cd - parse_logic: yq e '.. | select(has("repository")) |= (with(select(.tag == "" or .tag == null); .repository + ":v2.4.2") | with(select(.tag != "" and .tag != null); .repository + ":" + .tag))' dependencies: