diff options
13 files changed, 56 insertions, 51 deletions
diff --git a/inventory/host_vars/ch-testvm-edis.yml b/inventory/host_vars/ch-testvm-edis.yml index e059d9e8..d005b19b 100644 --- a/inventory/host_vars/ch-testvm-edis.yml +++ b/inventory/host_vars/ch-testvm-edis.yml @@ -1,7 +1,7 @@ --- install: cloud: - id: kvm_94527_260205 + id: kvm_94527_270280 credentials: email: equinox@chaos-at-home.org password: "{{ vault_edis_api_password }}" @@ -15,15 +15,15 @@ install: network: nameservers: - 1.1.1.1 - - 1.1.1.1 + - 1.0.0.1 - 2606:4700:4700::1111 domain: "{{ host_domain }}" primary: &_network_primary_ name: ens3 - address: 149.154.152.204/24 - gateway: 149.154.152.1 - address6: 2a03:f80:ed15:bb55::1/48 - gateway6: 2a03:f80:ed15::1 + address: 151.236.30.176/24 + gateway: 151.236.30.1 + address6: 2a03:f80:ed31:fde0::1/48 + gateway6: 2a03:f80:ed31::1 interfaces: - *_network_primary_ diff --git a/roles/cloud/install/tasks/edis-kvm.yml b/roles/cloud/install/tasks/edis-kvm.yml index 43bb6d52..f2ebe750 100644 --- a/roles/cloud/install/tasks/edis-kvm.yml +++ b/roles/cloud/install/tasks/edis-kvm.yml @@ -7,6 +7,7 @@ vars: installer_base_path: "{{ global_cache_dir }}/debian-installer" installer_keyrings_path: "{{ global_files_dir }}/common/keyrings" + debian_preseed_poweroff_when_done: yes import_role: name: installer/debian/iso @@ -81,7 +82,7 @@ set_fact: edis_kvm_custom_iso_fullpath: "{{ edis_kvm_installer_isos.json.data | select('match', '.*/' + install.cloud.id + '.iso') | first }}" -- name: mount custom iso +- name: mount and boot from custom iso delegate_to: localhost uri: url: "https://{{ edis_kvm_auth_session.api_host }}/kvm/v2/set/mount" @@ -92,61 +93,39 @@ signature: "{{ edis_kvm_auth_session.signature }}" valid_until: "{{ edis_kvm_auth_session.valid_until }}" iso: "{{ edis_kvm_custom_iso_fullpath }}" + force_reset: "yes" status_code: 200 -- name: make sure VNC access is disabled - delegate_to: localhost - uri: - url: "https://{{ edis_kvm_auth_session.api_host }}/kvm/v2/set/vnc/disable" - method: POST - body_format: form-urlencoded - body: - kvm_id: "{{ edis_kvm_auth_session.kvm_id }}" - signature: "{{ edis_kvm_auth_session.signature }}" - valid_until: "{{ edis_kvm_auth_session.valid_until }}" - status_code: 200 - -- name: wait for VNC disable to kick in +- name: installing the system pause: - seconds: 5 + minutes: 3 + prompt: | + Waiting for the installer to finish. You may watch the progress via the EDIS Managemet interface at -- name: generate random password for VNC access - set_fact: - edis_kvm_vnc_password: "{{ lookup('password', '/dev/null chars=ascii_lowercase,ascii_uppercase,digits length=8') }}" + https://manage.edis.at/whmcs/clientarea.php?action=services - ## TODO: sadly setting the password does not work -> create ticket @ edis support .... -- name: (re)enable VNC access with new temporary password + Just go to the product page of the VM {{ install.cloud.id }} and enable VNC. After that you may use the + built-in noVNC instance to watch the installer doing its thing. + + The installer will terminate the VM when done and the install process will continue automatically. + If the installation is done quicker than this you may press ENTER to continue or CTRL-C then A to abort. + +- name: wait for installer to shutdown the VM delegate_to: localhost uri: - url: "https://{{ edis_kvm_auth_session.api_host }}/kvm/v2/set/vnc/enable" + url: "https://{{ edis_kvm_auth_session.api_host }}/kvm/v2/get/power" method: POST body_format: form-urlencoded body: kvm_id: "{{ edis_kvm_auth_session.kvm_id }}" signature: "{{ edis_kvm_auth_session.signature }}" valid_until: "{{ edis_kvm_auth_session.valid_until }}" - vnc_pw: "{{ edis_kvm_vnc_password }}" - status_code: 200 - register: edis_kvm_vnc_info - -- name: user interaction needed... - pause: - prompt: | - Please connect to the VNC using the following link: - - https://manage.edis.at/novnc/?host={{ edis_kvm_vnc_info.json.vnc_host }}&port={{ edis_kvm_vnc_info.json.novnc_port }}&scale=true - - Alternativly you may connect to the VNC server at {{ edis_kvm_vnc_info.json.vnc_host }} on port {{ edis_kvm_vnc_info.json.vnc_port }} using any VNC compatible client. - - The VNC session is protected using this password: "{{ edis_kvm_vnc_password }}" - - While VNC is connected reboot the server (i.e. using CTRL+ALT+DEL) and then press F12 or ESC during the BIOS phase of - the boot. At the boot device selection menu select the DVD/CD drive entry that contains the string '(ISOIMAGE)' to - boot the installer. - - Once the installation is done press ENTER to continue or CTRL-C then A to abort. + register: edis_kvm_power_state + until: "edis_kvm_power_state.json.data == 'server powered off'" + retries: 60 + delay: 5 -- name: unount the installer iso image +- name: unmount the installer iso image delegate_to: localhost uri: url: "https://{{ edis_kvm_auth_session.api_host }}/kvm/v2/set/umount" @@ -158,10 +137,10 @@ valid_until: "{{ edis_kvm_auth_session.valid_until }}" status_code: 200 -- name: disable VNC access +- name: start the newly installed VM delegate_to: localhost uri: - url: "https://{{ edis_kvm_auth_session.api_host }}/kvm/v2/set/vnc/disable" + url: "https://{{ edis_kvm_auth_session.api_host }}/kvm/v2/set/poweron" method: POST body_format: form-urlencoded body: diff --git a/roles/installer/debian/preseed/defaults/main.yml b/roles/installer/debian/preseed/defaults/main.yml index 7e271783..1a8b5b67 100644 --- a/roles/installer/debian/preseed/defaults/main.yml +++ b/roles/installer/debian/preseed/defaults/main.yml @@ -18,6 +18,7 @@ debian_preseed_no_netplan: no # debian_preseed_kernel_image: debian_preseed_virtual_machine: no debian_preseed_no_splash: yes +debian_preseed_poweroff_when_done: no debian_preseed_manual_partitioning: no diff --git a/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2 index 30fa876b..fdc65ff7 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-bullseye.cfg.j2 @@ -70,6 +70,9 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i finish-install/reboot_in_progress note +{% if debian_preseed_poweroff_when_done %} +d-i debian-installer/exit/poweroff boolean true +{% endif %} d-i preseed/late_command string \ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 index 1fca669e..575f44a9 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 @@ -70,6 +70,9 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i finish-install/reboot_in_progress note +{% if debian_preseed_poweroff_when_done %} +d-i debian-installer/exit/poweroff boolean true +{% endif %} d-i preseed/late_command string \ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 index 43833b4e..3ad35d5a 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 @@ -70,6 +70,9 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i finish-install/reboot_in_progress note +{% if debian_preseed_poweroff_when_done %} +d-i debian-installer/exit/poweroff boolean true +{% endif %} d-i preseed/late_command string \ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 index 048c9895..7d6137e4 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -70,6 +70,9 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i finish-install/reboot_in_progress note +{% if debian_preseed_poweroff_when_done %} +d-i debian-installer/exit/poweroff boolean true +{% endif %} d-i preseed/late_command string \ diff --git a/roles/installer/debian/preseed/templates/preseed_kali-kali-rolling.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_kali-kali-rolling.cfg.j2 index 17a1732b..fc9a84a5 100644 --- a/roles/installer/debian/preseed/templates/preseed_kali-kali-rolling.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_kali-kali-rolling.cfg.j2 @@ -67,6 +67,9 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i finish-install/reboot_in_progress note +{% if debian_preseed_poweroff_when_done %} +d-i debian-installer/exit/poweroff boolean true +{% endif %} d-i preseed/late_command string \ diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 index dd854161..9d644e4d 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -85,6 +85,9 @@ popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none d-i finish-install/reboot_in_progress note +{% if debian_preseed_poweroff_when_done %} +d-i debian-installer/exit/poweroff boolean true +{% endif %} d-i preseed/late_command string \ diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 index 9295766f..48cc16bb 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 @@ -85,6 +85,9 @@ popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none d-i finish-install/reboot_in_progress note +{% if debian_preseed_poweroff_when_done %} +d-i debian-installer/exit/poweroff boolean true +{% endif %} d-i preseed/late_command string \ diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 index 0d5fe564..8bfbe61a 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -82,6 +82,9 @@ popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none d-i finish-install/reboot_in_progress note +{% if debian_preseed_poweroff_when_done %} +d-i debian-installer/exit/poweroff boolean true +{% endif %} d-i preseed/late_command string \ diff --git a/roles/installer/ubuntu/autoinstall/defaults/main.yml b/roles/installer/ubuntu/autoinstall/defaults/main.yml index 109ad855..50a35ae1 100644 --- a/roles/installer/ubuntu/autoinstall/defaults/main.yml +++ b/roles/installer/ubuntu/autoinstall/defaults/main.yml @@ -11,6 +11,7 @@ ubuntu_autoinstall_timezone: Europe/Vienna # ubuntu_autoinstall_kernel_image: ubuntu_autoinstall_virtual_machine: no # ubuntu_autoinstall_desktop: xubuntu +ubuntu_autoinstall_poweroff_when_done: no ubuntu_autoinstall_manual_partitioning: no diff --git a/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 b/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 index 1dfd44db..3a3e1689 100644 --- a/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 +++ b/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 @@ -225,7 +225,7 @@ autoinstall: - [ apt-get, -y, -q, auto-remove ] - [ bash, -c, 'dpkg -l | grep "^rc" | awk "{ print(\$2) }" | xargs -r dpkg -P' ] - [ sed, '/^PasswordAuthentication /d', -i, '/etc/ssh/sshd_config' ] -{% if ubuntu_autoinstall_virtual_machine %} +{% if ubuntu_autoinstall_poweroff_when_done %} - [ poweroff ] {% else %} - [ reboot ] |