Remove debugging;Housekeeping;Rename dict
This commit is contained in:
@ -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
|
||||
|
@ -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'] }}
|
||||
|
@ -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
|
||||
|
@ -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]})
|
||||
}}
|
||||
|
Reference in New Issue
Block a user