summaryrefslogtreecommitdiff
path: root/roles/installer/openbsd/autoinstall/templates/install.site.j2
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-12-26 23:25:02 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-12-26 23:25:02 +0100
commit74684fb93e26e2c9f37f699a84eb94acaf93c07a (patch)
treeb514b605b934a6ee074a200e75f918ba05ad109e /roles/installer/openbsd/autoinstall/templates/install.site.j2
parentnextcloud: upgrade all instances and add occ script (diff)
parentbase role supports openbsd now too (diff)
Merge branch 'topic/openbsd-test'
Diffstat (limited to 'roles/installer/openbsd/autoinstall/templates/install.site.j2')
-rw-r--r--roles/installer/openbsd/autoinstall/templates/install.site.j226
1 files changed, 26 insertions, 0 deletions
diff --git a/roles/installer/openbsd/autoinstall/templates/install.site.j2 b/roles/installer/openbsd/autoinstall/templates/install.site.j2
new file mode 100644
index 00000000..82928daa
--- /dev/null
+++ b/roles/installer/openbsd/autoinstall/templates/install.site.j2
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+echo "Generating random root pasword"
+usermod -p "$(openssl rand -base64 24 | encrypt)" root
+
+echo "Installing SSH keys for root"
+cat <<EOF > /root/.ssh/authorized_keys
+{{ ssh_keys_root | join('\n') }}
+EOF
+
+{% if hostvars[hostname].ansible_port is defined %}
+echo "Setting SSH port to {{ hostvars[hostname].ansible_port }}"
+sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config
+{% endif %}
+
+echo "Installing python"
+pkg_add -Im python%3.7
+
+echo "Disable sndiod service on first boot"
+cat <<EOF >> /etc/rc.firsttime
+
+rcctl disable sndiod
+rcctl stop sndiod
+EOF
+
+rm /install.site