summaryrefslogtreecommitdiff
path: root/roles/installer/openbsd/autoinstall/templates
diff options
context:
space:
mode:
Diffstat (limited to 'roles/installer/openbsd/autoinstall/templates')
-rw-r--r--roles/installer/openbsd/autoinstall/templates/auto_install.conf.j232
-rw-r--r--roles/installer/openbsd/autoinstall/templates/boot.conf.j25
-rw-r--r--roles/installer/openbsd/autoinstall/templates/install.site.j226
3 files changed, 63 insertions, 0 deletions
diff --git a/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 b/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2
new file mode 100644
index 00000000..18e85a80
--- /dev/null
+++ b/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2
@@ -0,0 +1,32 @@
+System hostname = {{ hostvars[hostname].host_name }}
+
+Which network interface do you wish to configure = {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }}
+{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %}
+IPv4 address = dhcp
+{% else %}
+IPv4 address = {{ hostvars[hostname].network_cooked.primary.ip }}
+Netmask = {{ hostvars[hostname].network_cooked.primary.mask }}
+Default IPv4 route = {{ hostvars[hostname].network_cooked.primary.gateway }}
+{% endif %}
+DNS domain name = {{ hostvars[hostname].network_cooked.domain }}
+DNS nameservers = {{ hostvars[hostname].network_cooked.nameservers | join(' ') }}
+
+{% if obsd_autoinstall_serial_device is defined %}
+Change the default console to {{ obsd_autoinstall_serial_device }} = yes
+Which speed should {{ obsd_autoinstall_serial_device }} use = {{ obsd_autoinstall_tty_serial | default(115200) }}
+{% endif %}
+
+{# we will install only one key for now, install.site will install the rest #}
+Public ssh key for root account = {{ ssh_keys_root[0] }}
+Password for root = this-very-very-secure-password-will-be-overwritten-by-install.site
+Setup a user = no
+Start sshd(8) by default = yes
+Allow root ssh login = prohibit-password
+
+What timezone are you in = Europe/Vienna
+
+Location of sets = cd0
+Pathname to the sets = sets/
+Set name(s) = all
+{# iso-images don't contain the SHA256.sig file but are verified when downloading the iso-file #}
+Directory does not contain SHA256.sig. Continue without verification = yes
diff --git a/roles/installer/openbsd/autoinstall/templates/boot.conf.j2 b/roles/installer/openbsd/autoinstall/templates/boot.conf.j2
new file mode 100644
index 00000000..d6cdcfeb
--- /dev/null
+++ b/roles/installer/openbsd/autoinstall/templates/boot.conf.j2
@@ -0,0 +1,5 @@
+{% if obsd_autoinstall_serial_device is defined %}
+stty {{ obsd_autoinstall_serial_device }} {{ obsd_autoinstall_tty_serial | default(115200) }}
+set tty {{ obsd_autoinstall_serial_device }}
+{% endif %}
+set image /bsd.rd
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