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
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

View File

@ -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'] }}

View File

@ -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

View File

@ -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]})
}}

View File

@ -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 }}

View File

@ -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: