summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chaos-at-home/ch-keyserver.yml1
-rw-r--r--chaos-at-home/common.yml1
-rw-r--r--common/cloud-install.yml8
-rw-r--r--common/vm-install.yml7
-rw-r--r--roles/cloud/install/templates/hetzner_postinst.sh.j211
5 files changed, 27 insertions, 1 deletions
diff --git a/chaos-at-home/ch-keyserver.yml b/chaos-at-home/ch-keyserver.yml
index 78923149..9b032bb3 100644
--- a/chaos-at-home/ch-keyserver.yml
+++ b/chaos-at-home/ch-keyserver.yml
@@ -5,4 +5,5 @@
- role: base
- role: sshd
- role: zsh
+ - role: apt-repo/base
- role: admin-user
diff --git a/chaos-at-home/common.yml b/chaos-at-home/common.yml
index 494f434f..59024522 100644
--- a/chaos-at-home/common.yml
+++ b/chaos-at-home/common.yml
@@ -5,3 +5,4 @@
- role: base
- role: sshd
- role: zsh
+ - role: apt-repo/base
diff --git a/common/cloud-install.yml b/common/cloud-install.yml
index 414cabd1..875d2880 100644
--- a/common/cloud-install.yml
+++ b/common/cloud-install.yml
@@ -5,6 +5,7 @@
roles:
- role: cloud/install
+
- name: wait for newly installed machine to start up
hosts: "{{ install_hostname }}"
gather_facts: no
@@ -13,14 +14,20 @@
- name: disable ssh StrictHostKeyChecking for the next step
set_fact:
ansible_ssh_extra_args: -o StrictHostKeyChecking=no
+
+ - name: clear all gathered facts
+ meta: clear_facts
+
- name: wait for newly installed machine to start up
wait_for_connection:
delay: 5
timeout: 120
+
- name: reenable StrictHostKeyChecking
set_fact:
ansible_ssh_extra_args: ""
+
- name: run post install roles
hosts: "{{ install_hostname }}"
pre_tasks:
@@ -29,6 +36,7 @@
roles:
- role: cloud/post-install
+
- name: reboot and wait for machine come back
hosts: "{{ install_hostname }}"
gather_facts: no
diff --git a/common/vm-install.yml b/common/vm-install.yml
index 7aaf32fc..f90d0cd0 100644
--- a/common/vm-install.yml
+++ b/common/vm-install.yml
@@ -29,6 +29,7 @@
roles:
- role: vm/install
+
- name: wait for new vm to start up
hosts: "{{ install_hostname }}"
gather_facts: no
@@ -37,14 +38,20 @@
- name: disable ssh StrictHostKeyChecking for the next step
set_fact:
ansible_ssh_extra_args: -o StrictHostKeyChecking=no
+
+ - name: clear all gathered facts
+ meta: clear_facts
+
- name: wait for vm to start up
wait_for_connection:
delay: 5
timeout: 120
+
- name: reenable StrictHostKeyChecking
set_fact:
ansible_ssh_extra_args: ""
+
- name: apply basic VM configuration roles
hosts: "{{ install_hostname }}"
pre_tasks:
diff --git a/roles/cloud/install/templates/hetzner_postinst.sh.j2 b/roles/cloud/install/templates/hetzner_postinst.sh.j2
index 39a3fd7d..df1565c7 100644
--- a/roles/cloud/install/templates/hetzner_postinst.sh.j2
+++ b/roles/cloud/install/templates/hetzner_postinst.sh.j2
@@ -1,10 +1,19 @@
#!/bin/bash
set -euf -o pipefail
+OS_DISTRO=$(. /etc/os-release; echo $ID)
+OS_MAJOR_VERSION=$(. /etc/os-release; echo $VERSION_ID | cut -d . -f 1)
+
export DEBIAN_FRONTEND=noninteractive
apt-get update -q
apt-get full-upgrade -y -q
-apt-get install -y -q --no-install-recommends openssh-server python python-apt
+apt-get install -y -q --no-install-recommends openssh-server
+if [ "$OS_DISTRO" == "ubuntu" ] && [ "$OS_MAJOR_VERSION" -ge 20 ]; then
+ apt-get install -y -q --no-install-recommends python3 python3-apt
+else
+ apt-get install -y -q --no-install-recommends python python-apt
+fi
+
passwd -d root && passwd -l root
{% if install_distro == "debian" %}