Remove debugging;Housekeeping;Rename dict

This commit is contained in:
Danny Bessems 2022-06-27 10:55:17 +02:00
parent 1cdbcaccaf
commit 8f432d3353
6 changed files with 10 additions and 14 deletions

View File

@ -1,10 +1,12 @@
- name: Set hostname - name: Set hostname
ansible.builtin.hostname: ansible.builtin.hostname:
name: "{{ ovfproperties['guestinfo.hostname'] }}" name: "{{ vapp['guestinfo.hostname'] }}"
- name: Create netplan configuration file - name: Create netplan configuration file
ansible.builtin.template: ansible.builtin.template:
src: netplan.j2 src: netplan.j2
dest: /etc/netplan/00-installer-config.yaml dest: /etc/netplan/00-installer-config.yaml
- name: Apply netplan configuration - name: Apply netplan configuration
ansible.builtin.shell: ansible.builtin.shell:
cmd: /usr/sbin/netplan apply cmd: /usr/sbin/netplan apply

View File

@ -3,8 +3,8 @@ network:
ethernets: ethernets:
ens192: ens192:
addresses: addresses:
- {{ ovfproperties['guestinfo.ipaddress'] }}/{{ ovfproperties['guestinfo.prefixlength'] }} - {{ vapp['guestinfo.ipaddress'] }}/{{ vapp['guestinfo.prefixlength'] }}
gateway4: {{ ovfproperties['guestinfo.gateway'] }} gateway4: {{ vapp['guestinfo.gateway'] }}
nameservers: nameservers:
addresses: addresses:
- {{ ovfproperties['guestinfo.dnsserver'] }} - {{ vapp['guestinfo.dnsserver'] }}

View File

@ -1,14 +1,14 @@
- name: Set root password - name: Set root password
ansible.builtin.user: ansible.builtin.user:
name: root 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 generate_ssh_key: yes
ssh_key_bits: 2048 ssh_key_bits: 2048
ssh_key_file: .ssh/id_rsa ssh_key_file: .ssh/id_rsa
- name: Save root SSH publickey - name: Save root SSH publickey
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /root/.ssh/authorized_keys path: /root/.ssh/authorized_keys
line: "{{ ovfproperties['guestinfo.rootsshkey'] }}" line: "{{ vapp['guestinfo.rootsshkey'] }}"
- name: Disable SSH password authentication - name: Disable SSH password authentication
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config path: /etc/ssh/sshd_config

View File

@ -12,8 +12,8 @@
register: ovfenv register: ovfenv
- name: Assign vApp properties to dictionary - name: Assign vApp properties to dictionary
ansible.builtin.set_fact: ansible.builtin.set_fact:
ovfproperties: >- vapp: >-
{{ ovfproperties | default({}) | {{ vapp | default({}) |
combine({((item.values() | list)[0].values() | list)[0]: combine({((item.values() | list)[0].values() | list)[0]:
((item.values() | list)[0].values() | list)[1]}) ((item.values() | list)[0].values() | list)[1]})
}} }}

View File

@ -30,9 +30,6 @@
loop_control: loop_control:
label: "{{ item.key }}" label: "{{ item.key }}"
- ansible.builtin.debug:
var: containerimages
- name: Pull and store containerimages - name: Pull and store containerimages
ansible.builtin.command: ansible.builtin.command:
cmd: skopeo copy docker://{{ item }} docker-archive:./{{ ( item | regex_findall('[^/:]+'))[-2] }}.tar:{{ item }} cmd: skopeo copy docker://{{ item }} docker-archive:./{{ ( item | regex_findall('[^/:]+'))[-2] }}.tar:{{ item }}

View File

@ -17,19 +17,16 @@ components:
helm: helm:
version: 1.3.0 version: 1.3.0
chart: longhorn/longhorn chart: longhorn/longhorn
parse_logic: yq e '.. | select(has("repository")) | .repository + ":" + .tag'
harbor: harbor:
helm: helm:
version: 1.9.1 # (= Harbor v2.5.1) version: 1.9.1 # (= Harbor v2.5.1)
chart: harbor/harbor chart: harbor/harbor
parse_logic: yq e '.. | select(has("repository")) | .repository + ":" + .tag'
argo-cd: argo-cd:
helm: helm:
version: 4.9.7 # (= ArgoCD v2.4.2) version: 4.9.7 # (= ArgoCD v2.4.2)
chart: argo/argo-cd 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: dependencies: