summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-12-26 03:35:16 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-12-26 03:35:16 +0100
commit7b2223d9eeefa92ea968836d6c65c4d96461cdf7 (patch)
tree6fa96460e5721d5cb7845aacf665cbfe6bbbb1be /roles
parentopenbsd installer: generate iso with filesets (diff)
openbsd: add site.tgz to further customize the installation
Diffstat (limited to 'roles')
-rw-r--r--roles/installer/openbsd/autoinstall/tasks/main.yml20
-rw-r--r--roles/installer/openbsd/autoinstall/templates/auto_install.conf.j24
-rw-r--r--roles/installer/openbsd/autoinstall/templates/install.site.j221
3 files changed, 39 insertions, 6 deletions
diff --git a/roles/installer/openbsd/autoinstall/tasks/main.yml b/roles/installer/openbsd/autoinstall/tasks/main.yml
index 79aa8eda..a4e63f3f 100644
--- a/roles/installer/openbsd/autoinstall/tasks/main.yml
+++ b/roles/installer/openbsd/autoinstall/tasks/main.yml
@@ -1,10 +1,11 @@
---
-- name: create basic cd-image directory structure
+- name: create temporary directories
loop:
- - etc
- - sets
+ - files/etc
+ - files/sets
+ - site/
file:
- path: "{{ obsd_autoinstall_tmpdir }}/files/{{ item }}"
+ path: "{{ obsd_autoinstall_tmpdir }}/{{ item }}"
state: directory
- name: extract installer files from iso
@@ -39,6 +40,17 @@
dest: "{{ obsd_autoinstall_tmpdir }}/files/sets"
files: "{{ [obsd_autoinstall_version+'/'+obsd_autoinstall_arch+'/'] | product(set_names | flatten) | map('join') | list }}"
+- name: generate install.site script
+ template:
+ src: install.site.j2
+ dest: "{{ obsd_autoinstall_tmpdir }}/site/install.site"
+ mode: 0755
+
+- name: generate site tarball
+ archive:
+ path: "{{ obsd_autoinstall_tmpdir }}/site/"
+ dest: "{{ obsd_autoinstall_tmpdir }}/files/sets/site{{ obsd_autoinstall_version_short }}.tgz"
+
- name: generate host specific installer image
command: 'genisoimage -RTLldDN -o "install.iso" -no-emul-boot -b "cdbr" -c "boot.catalog" files/'
args:
diff --git a/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 b/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2
index 46a87cc8..18e85a80 100644
--- a/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2
+++ b/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2
@@ -16,9 +16,9 @@ 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 %}
-{# TODO: what if there are more than one ssh keys? #}
+{# 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 = !
+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
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..f4f9524d
--- /dev/null
+++ b/roles/installer/openbsd/autoinstall/templates/install.site.j2
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+## TODO: enable this once we know how this works
+## echo "Generating random root pasword"
+## openssl rand -base64 24 | passwd 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
+
+
+rm /install.site