From bc58c7f37ee2bd1bc341cb95f849af746811754f Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 12 Dec 2019 22:30:05 +0100 Subject: trial support openbsd in sshd and zsh roles --- inventory/hosts.ini | 1 + roles/sshd/handlers/main.yml | 2 +- roles/sshd/tasks/main.yml | 5 ----- roles/zsh/tasks/main.yml | 20 +++++++++++--------- roles/zsh/templates/banner.chaos-at-home.j2 | 2 +- roles/zsh/templates/banner.elevate.j2 | 2 +- roles/zsh/templates/banner.skillz.j2 | 2 +- roles/zsh/templates/banner.spreadspace.j2 | 2 +- 8 files changed, 17 insertions(+), 19 deletions(-) diff --git a/inventory/hosts.ini b/inventory/hosts.ini index e6c3cc97..4d136bd3 100644 --- a/inventory/hosts.ini +++ b/inventory/hosts.ini @@ -23,6 +23,7 @@ ch-gnocchi host_name=gnocchi ch-router host_name=router ch-gw-lan host_name=gw-lan ch-jump host_name=jump ansible_port=2342 ansible_host=ch-jump +ch-router-obsd ansible_port=4222 [chaos-at-home:children] mz-chaos-at-home diff --git a/roles/sshd/handlers/main.yml b/roles/sshd/handlers/main.yml index 822887e3..f43817f2 100644 --- a/roles/sshd/handlers/main.yml +++ b/roles/sshd/handlers/main.yml @@ -1,5 +1,5 @@ --- - name: restart ssh service: - name: ssh + name: sshd state: restarted diff --git a/roles/sshd/tasks/main.yml b/roles/sshd/tasks/main.yml index 2977d20b..f98ea536 100644 --- a/roles/sshd/tasks/main.yml +++ b/roles/sshd/tasks/main.yml @@ -1,9 +1,4 @@ --- -- name: install ssh-server - apt: - name: openssh-server - state: present - - name: hardening ssh-server config vars: sshd_options: diff --git a/roles/zsh/tasks/main.yml b/roles/zsh/tasks/main.yml index 80880f83..f0aa696e 100644 --- a/roles/zsh/tasks/main.yml +++ b/roles/zsh/tasks/main.yml @@ -1,13 +1,13 @@ --- - name: install zsh packages - apt: + openbsd_pkg: name: zsh state: present - name: install zsh-config loop: - src: "zshrc" - dest: "/etc/zsh/zshrc" + dest: "/etc/zshrc" - src: "zshrc.skel" dest: "/etc/skel/.zshrc" loop_control: @@ -20,19 +20,20 @@ loop: "{{ [ 'root' ] | union(zsh_loginshell_user | default([])) }}" user: name: "{{ item }}" - shell: /bin/zsh + shell: /usr/local/bin/zsh - name: make zsh the default shell for useradd lineinfile: - regexp: '^#?SHELL=' - line: 'SHELL=/bin/zsh' - path: /etc/default/useradd + regexp: '^#?shell\s' + line: 'shell /usr/local/bin/zsh' + path: /etc/usermgmt.conf - name: make zsh the default shell for adduser lineinfile: - regexp: '^#?DSHELL=' - line: 'DSHELL=/bin/zsh' + regexp: '^#?defaultshell=' + line: 'defaultshell=/usr/local/bin/zsh' path: /etc/adduser.conf + create: yes - name: install shell banner when: zsh_banner is defined @@ -46,6 +47,7 @@ - name: enable banner for zsh login lineinfile: - path: /etc/zsh/zlogin + path: /etc/zlogin line: /etc/banner.sh insertbefore: "^## END OF FILE #" + create: yes diff --git a/roles/zsh/templates/banner.chaos-at-home.j2 b/roles/zsh/templates/banner.chaos-at-home.j2 index 74762bbe..e9b6baa9 100644 --- a/roles/zsh/templates/banner.chaos-at-home.j2 +++ b/roles/zsh/templates/banner.chaos-at-home.j2 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/ksh echo -e "" echo -e " \033[0;37m █████╗██╗ ██╗ ████╗ █████╗ ██████╗\033[1;30m ██████╗ \033[0;37m██╗ ██╗ █████╗ ███╗ ███╗█████╗\033[0m" diff --git a/roles/zsh/templates/banner.elevate.j2 b/roles/zsh/templates/banner.elevate.j2 index d2c9b907..cca0850d 100644 --- a/roles/zsh/templates/banner.elevate.j2 +++ b/roles/zsh/templates/banner.elevate.j2 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/ksh echo -e "" echo -e " \033[1;37m██████████ ██ ██████████ ▜█▙ ▟█▛ ▟██▙ ██████████ ██████████\033[0m" diff --git a/roles/zsh/templates/banner.skillz.j2 b/roles/zsh/templates/banner.skillz.j2 index 8492c918..f750f9e6 100644 --- a/roles/zsh/templates/banner.skillz.j2 +++ b/roles/zsh/templates/banner.skillz.j2 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/ksh echo -e "" echo -e " \033[1;35m███████╗██╗ ██╗██╗██╗ ██╗ ███████╗\033[0;35m ██████╗ ██╗███████╗\033[0m" diff --git a/roles/zsh/templates/banner.spreadspace.j2 b/roles/zsh/templates/banner.spreadspace.j2 index ec59509f..580aa4c8 100644 --- a/roles/zsh/templates/banner.spreadspace.j2 +++ b/roles/zsh/templates/banner.spreadspace.j2 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/ksh echo -e "" echo -e " \033[0;33m█████╗█████╗ █████╗ █████╗ ████╗ █████╗ █████╗█████╗ ████╗ ████╗█████╗\033[0m" -- cgit v1.2.3 From 27c9986590371d4b706ddb7d5628bef0f4b8b2bc Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 14 Dec 2019 01:57:03 +0100 Subject: some more tests for openbsd install --- chaos-at-home/ch-router-obsd.yml | 7 ++++++ common/vm-install.yml | 18 +++++++-------- inventory/group_vars/chaos-at-home/network.yml | 1 + inventory/host_vars/ch-router-obsd.yml | 21 +++++++++++++++++ inventory/hosts.ini | 4 +++- roles/vm/define/tasks/main.yml | 1 - roles/vm/define/templates/libvirt-domain.xml.j2 | 9 ++++++-- roles/vm/install/meta/main.yml | 12 +++++----- roles/vm/install/tasks/main.yml | 30 ++++++++++++------------- 9 files changed, 69 insertions(+), 34 deletions(-) create mode 100644 chaos-at-home/ch-router-obsd.yml create mode 100644 inventory/host_vars/ch-router-obsd.yml diff --git a/chaos-at-home/ch-router-obsd.yml b/chaos-at-home/ch-router-obsd.yml new file mode 100644 index 00000000..fe3ef36f --- /dev/null +++ b/chaos-at-home/ch-router-obsd.yml @@ -0,0 +1,7 @@ +--- +- name: Basic Setup + hosts: ch-router-obsd + roles: + #- role: base + - role: sshd + - role: zsh diff --git a/common/vm-install.yml b/common/vm-install.yml index 36f2c4cc..02c95fd8 100644 --- a/common/vm-install.yml +++ b/common/vm-install.yml @@ -45,15 +45,15 @@ set_fact: ansible_ssh_extra_args: "" -- name: apply basic VM configuration roles - hosts: "{{ hostname }}" - pre_tasks: - - name: make sure to update cached facts - setup: - roles: - - role: vm/grub - - role: vm/network - - role: vm/guest +# - name: apply basic VM configuration roles +# hosts: "{{ hostname }}" +# pre_tasks: +# - name: make sure to update cached facts +# setup: +# roles: +# - role: vm/grub +# - role: vm/network +# - role: vm/guest - import_playbook: "../{{ hostenv }}/{{ hostname }}.yml" diff --git a/inventory/group_vars/chaos-at-home/network.yml b/inventory/group_vars/chaos-at-home/network.yml index 73aa2975..28a29081 100644 --- a/inventory/group_vars/chaos-at-home/network.yml +++ b/inventory/group_vars/chaos-at-home/network.yml @@ -43,6 +43,7 @@ network_zones: ch-stats: 10 ch-web: 80 ch-mail: 143 + ch-router-obsd: 253 ch-router: 254 mgmt: diff --git a/inventory/host_vars/ch-router-obsd.yml b/inventory/host_vars/ch-router-obsd.yml new file mode 100644 index 00000000..48788004 --- /dev/null +++ b/inventory/host_vars/ch-router-obsd.yml @@ -0,0 +1,21 @@ +--- +vm_host: ch-gnocchi + +install: + host: "{{ vm_host }}" + mem: 512 + numcpu: 1 + disks: + primary: /dev/sda + virtio: + vda: + type: lvm + vg: "{{ hostvars[vm_host].host_name }}" + lv: "{{ inventory_hostname }}" + size: 10g + interfaces: + - bridge: br-svc + name: vi0 + autostart: True + +network: {} diff --git a/inventory/hosts.ini b/inventory/hosts.ini index 4d136bd3..b45fb494 100644 --- a/inventory/hosts.ini +++ b/inventory/hosts.ini @@ -21,9 +21,9 @@ ch-testvm host_name=testvm ch-mimas2 host_name=mimas ch-gnocchi host_name=gnocchi ch-router host_name=router +ch-router-obsd host_name=router ansible_port=22 ch-gw-lan host_name=gw-lan ch-jump host_name=jump ansible_port=2342 ansible_host=ch-jump -ch-router-obsd ansible_port=4222 [chaos-at-home:children] mz-chaos-at-home @@ -194,6 +194,8 @@ ch-keyserver ch-testvm ch-gw-lan ch-jump +ch-router +ch-router-obsd r3-vex2 r3-cccamp19-flora r3-cccamp19-verr diff --git a/roles/vm/define/tasks/main.yml b/roles/vm/define/tasks/main.yml index 202644dd..4c2b99e1 100644 --- a/roles/vm/define/tasks/main.yml +++ b/roles/vm/define/tasks/main.yml @@ -23,7 +23,6 @@ name: "{{ hostname }}" command: undefine - - name: define vm virt: command: define diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index c7e3a2f2..a6aea91c 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -42,11 +42,16 @@ {% if vm_define_installer and install_distro == 'openbsd' %} - - + + + + + + + {% endif %} {% if 'virtio' in hostvars[hostname].install_cooked.disks %} diff --git a/roles/vm/install/meta/main.yml b/roles/vm/install/meta/main.yml index 710f90ad..347e30c4 100644 --- a/roles/vm/install/meta/main.yml +++ b/roles/vm/install/meta/main.yml @@ -1,7 +1,7 @@ --- -dependencies: - - role: installer/debian - distros: - - distro: "{{ install_distro }}" - codename: "{{ install_codename }}" - arch: [ "{{ hostvars[hostname].install_cooked.arch | default('amd64') }}" ] +# dependencies: +# - role: installer/debian +# distros: +# - distro: "{{ install_distro }}" +# codename: "{{ install_codename }}" +# arch: [ "{{ hostvars[hostname].install_cooked.arch | default('amd64') }}" ] diff --git a/roles/vm/install/tasks/main.yml b/roles/vm/install/tasks/main.yml index 162ece24..10b10e18 100644 --- a/roles/vm/install/tasks/main.yml +++ b/roles/vm/install/tasks/main.yml @@ -28,22 +28,22 @@ state: directory register: tmpdir - - import_role: - name: preseed - vars: - ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" - preseed_tmpdir: "{{ tmpdir.path }}" - preseed_force_net_ifnames_policy: path - preseed_no_netplan: yes - install_interface: enp1s1 + # - import_role: + # name: preseed + # vars: + # ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" + # preseed_tmpdir: "{{ tmpdir.path }}" + # preseed_force_net_ifnames_policy: path + # preseed_no_netplan: yes + # install_interface: enp1s1 - - name: Make preseed workdir readable by qemu - acl: - path: "{{ tmpdir.path }}" - state: present - entity: libvirt-qemu - etype: user - permissions: rx + # - name: Make preseed workdir readable by qemu + # acl: + # path: "{{ tmpdir.path }}" + # state: present + # entity: libvirt-qemu + # etype: user + # permissions: rx - import_role: name: vm/define -- cgit v1.2.3 From e7b9566f9e03860bc4b84b03abff670cffd21646 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 22 Dec 2019 14:03:06 +0100 Subject: openbsd: try to enable com0 for kernel terminal (WIP) --- roles/installer/openbsd/defaults/main.yml | 2 +- roles/installer/openbsd/tasks/main.yml | 43 +++++++++++++++++++++++-- roles/vm/define/templates/libvirt-domain.xml.j2 | 4 +-- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/roles/installer/openbsd/defaults/main.yml b/roles/installer/openbsd/defaults/main.yml index 004b8ecc..6650e064 100644 --- a/roles/installer/openbsd/defaults/main.yml +++ b/roles/installer/openbsd/defaults/main.yml @@ -5,4 +5,4 @@ openbsd_versions: - i386 openbsd_installer_force_download: no -openbsd_installer_url: "https://cdn.openbsd.org/pub/OpenBSD/" +openbsd_installer_url: "https://ftp2.eu.openbsd.org/pub/OpenBSD/" diff --git a/roles/installer/openbsd/tasks/main.yml b/roles/installer/openbsd/tasks/main.yml index e7196258..c6317284 100644 --- a/roles/installer/openbsd/tasks/main.yml +++ b/roles/installer/openbsd/tasks/main.yml @@ -11,7 +11,46 @@ loop_control: label: "openbsd-{{ item.0.version }} {{ item.1 }}" get_url: - url: "{{ openbsd_installer_url }}/{{ item.0.version }}/{{ item.1 }}/install{{ item.0.version | replace('.', '') }}.iso" - dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/install.iso" + url: "{{ openbsd_installer_url }}/{{ item.0.version }}/{{ item.1 }}/cd{{ item.0.version | replace('.', '') }}.iso" + dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd.iso" mode: 0644 force: "{{ openbsd_installer_force_download }}" + +- name: install xorriso + apt: + name: xorriso + state: present + +## TODO: only do this if images have been updated +- name: extract boot.conf from original iso image + loop: "{{ openbsd_versions | subelements('arch') }}" + loop_control: + label: "openbsd-{{ item.0.version }} {{ item.1 }}" + command: xorriso -osirrox on -dev cd.iso -extract etc/boot.conf boot.conf + args: + chdir: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" + +- name: change boot.conf to switch to com0 as main tty + loop: "{{ openbsd_versions | subelements('arch') }}" + loop_control: + label: "openbsd-{{ item.0.version }} {{ item.1 }}" + lineinfile: + path: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/boot.conf" + regexp: '^set\s+tty\s' + line: "set tty com0" + +- name: make sure target image does not exist + loop: "{{ openbsd_versions | subelements('arch') }}" + loop_control: + label: "openbsd-{{ item.0.version }} {{ item.1 }}" + file: + path: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd-com0.iso" + state: absent + +- name: generate target iso image + loop: "{{ openbsd_versions | subelements('arch') }}" + loop_control: + label: "openbsd-{{ item.0.version }} {{ item.1 }}" + command: xorriso -indev "cd.iso" -outdev "cd-com0.iso" -boot_image any keep -pathspecs on -add /etc/boot.conf=boot.conf + args: + chdir: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index a6aea91c..809a4a1e 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -44,7 +44,7 @@ {% if vm_define_installer and install_distro == 'openbsd' %} - + @@ -52,8 +52,8 @@ -{% endif %} +{% endif %} {% if 'virtio' in hostvars[hostname].install_cooked.disks %} {% for device, src in hostvars[hostname].install_cooked.disks.virtio.items() %} -- cgit v1.2.3 From 02e8e69cb1dd0f1a5445c973a317b40a230c62f3 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 23 Dec 2019 23:56:25 +0100 Subject: openbsd automatic install, added todo --- roles/installer/openbsd/tasks/main.yml | 58 +++++++++++++--------------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/roles/installer/openbsd/tasks/main.yml b/roles/installer/openbsd/tasks/main.yml index c6317284..fcc79589 100644 --- a/roles/installer/openbsd/tasks/main.yml +++ b/roles/installer/openbsd/tasks/main.yml @@ -12,45 +12,31 @@ label: "openbsd-{{ item.0.version }} {{ item.1 }}" get_url: url: "{{ openbsd_installer_url }}/{{ item.0.version }}/{{ item.1 }}/cd{{ item.0.version | replace('.', '') }}.iso" - dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd.iso" + dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd-orig.iso" mode: 0644 force: "{{ openbsd_installer_force_download }}" -- name: install xorriso +- name: install geniosimage apt: - name: xorriso + name: geniosimage state: present -## TODO: only do this if images have been updated -- name: extract boot.conf from original iso image - loop: "{{ openbsd_versions | subelements('arch') }}" - loop_control: - label: "openbsd-{{ item.0.version }} {{ item.1 }}" - command: xorriso -osirrox on -dev cd.iso -extract etc/boot.conf boot.conf - args: - chdir: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" - -- name: change boot.conf to switch to com0 as main tty - loop: "{{ openbsd_versions | subelements('arch') }}" - loop_control: - label: "openbsd-{{ item.0.version }} {{ item.1 }}" - lineinfile: - path: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/boot.conf" - regexp: '^set\s+tty\s' - line: "set tty com0" - -- name: make sure target image does not exist - loop: "{{ openbsd_versions | subelements('arch') }}" - loop_control: - label: "openbsd-{{ item.0.version }} {{ item.1 }}" - file: - path: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd-com0.iso" - state: absent - -- name: generate target iso image - loop: "{{ openbsd_versions | subelements('arch') }}" - loop_control: - label: "openbsd-{{ item.0.version }} {{ item.1 }}" - command: xorriso -indev "cd.iso" -outdev "cd-com0.iso" -boot_image any keep -pathspecs on -add /etc/boot.conf=boot.conf - args: - chdir: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" +## TODO +# - iso_extract from cd-orig.iso -> <>/<>/{boot.catalog,cdbr,cdboot,bsd.rd}, etc/boot.conf +# - add lines to etc/boot.conf -> stty com0 115200, set tty com0 +# - generate etc/auto_install.conf +# - name: generate host specific installer image +# loop: "{{ openbsd_versions | subelements('arch') }}" +# loop_control: +# label: "openbsd-{{ item.0.version }} {{ item.1 }}" +# command: 'genisoimage -RTLldDN -o "cd-{{ ansible_nodename }}.iso" -no-emul-boot -b "{{ item.0.version }}/{{ item.1 }}/cdbr" -c "{{ item.0.version }}/{{ item.1 }}/boot.catalog" data-{{ ansible_nodename }}/' +# args: +# chdir: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" +# +# - print instructions +# * attach to console +# * select (S)hell +# * # mount_cd9660 /dev/cd0c /mnt +# * # cp /mnt/etc/auto_install.conf / +# * # autoinstall +# -- cgit v1.2.3 From b8e0b8a6bf8fb3e879d0cd2d453e54f16a62a75e Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 24 Dec 2019 13:53:37 +0100 Subject: installer: move bootstrap roles to common subdir --- chaos-at-home/ch-atlas.yml | 2 +- chaos-at-home/ch-gnocchi.yml | 4 +- dan/sk-2019vm.yml | 2 +- preseed/.gitignore | 2 - preseed/fetch-example.sh | 29 ---- preseed/hosts/Readme.md | 15 -- preseed/hosts/calypso_debian-stretch.cfg | 129 ---------------- preseed/hosts/dione_debian-stretch.cfg | 114 -------------- preseed/hosts/helene_debian-stretch.cfg | 114 -------------- preseed/hosts/telesto_debian-stretch.cfg | 126 ---------------- roles/installer/debian/base/defaults/main.yml | 22 +++ roles/installer/debian/base/tasks/main.yml | 27 ++++ roles/installer/debian/defaults/main.yml | 22 --- roles/installer/debian/preseed/defaults/main.yml | 4 + roles/installer/debian/preseed/tasks/main.yml | 47 ++++++ .../preseed/templates/preseed_debian-buster.cfg.j2 | 147 ++++++++++++++++++ .../preseed/templates/preseed_debian-jessie.cfg.j2 | 147 ++++++++++++++++++ .../templates/preseed_debian-stretch.cfg.j2 | 147 ++++++++++++++++++ .../preseed/templates/preseed_ubuntu-bionic.cfg.j2 | 160 ++++++++++++++++++++ .../preseed/templates/preseed_ubuntu-xenial.cfg.j2 | 153 +++++++++++++++++++ ...preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 | 166 +++++++++++++++++++++ roles/installer/debian/tasks/main.yml | 27 ---- roles/installer/openbsd/base/defaults/main.yml | 8 + roles/installer/openbsd/base/tasks/main.yml | 42 ++++++ roles/installer/openbsd/defaults/main.yml | 8 - roles/installer/openbsd/tasks/main.yml | 42 ------ roles/preseed/defaults/main.yml | 4 - roles/preseed/tasks/main.yml | 47 ------ .../preseed/templates/preseed_debian-buster.cfg.j2 | 147 ------------------ .../preseed/templates/preseed_debian-jessie.cfg.j2 | 147 ------------------ .../templates/preseed_debian-stretch.cfg.j2 | 147 ------------------ .../preseed/templates/preseed_ubuntu-bionic.cfg.j2 | 160 -------------------- .../preseed/templates/preseed_ubuntu-xenial.cfg.j2 | 153 ------------------- ...preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 | 166 --------------------- roles/usb-install/meta/main.yml | 2 +- roles/usb-install/tasks/main.yml | 2 +- roles/vm/install/meta/main.yml | 2 +- roles/vm/install/tasks/main.yml | 2 +- 38 files changed, 1078 insertions(+), 1607 deletions(-) delete mode 100644 preseed/.gitignore delete mode 100755 preseed/fetch-example.sh delete mode 100644 preseed/hosts/Readme.md delete mode 100644 preseed/hosts/calypso_debian-stretch.cfg delete mode 100644 preseed/hosts/dione_debian-stretch.cfg delete mode 100644 preseed/hosts/helene_debian-stretch.cfg delete mode 100644 preseed/hosts/telesto_debian-stretch.cfg create mode 100644 roles/installer/debian/base/defaults/main.yml create mode 100644 roles/installer/debian/base/tasks/main.yml delete mode 100644 roles/installer/debian/defaults/main.yml create mode 100644 roles/installer/debian/preseed/defaults/main.yml create mode 100644 roles/installer/debian/preseed/tasks/main.yml create mode 100644 roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 create mode 100644 roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 create mode 100644 roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 create mode 100644 roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 create mode 100644 roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 create mode 100644 roles/installer/debian/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 delete mode 100644 roles/installer/debian/tasks/main.yml create mode 100644 roles/installer/openbsd/base/defaults/main.yml create mode 100644 roles/installer/openbsd/base/tasks/main.yml delete mode 100644 roles/installer/openbsd/defaults/main.yml delete mode 100644 roles/installer/openbsd/tasks/main.yml delete mode 100644 roles/preseed/defaults/main.yml delete mode 100644 roles/preseed/tasks/main.yml delete mode 100644 roles/preseed/templates/preseed_debian-buster.cfg.j2 delete mode 100644 roles/preseed/templates/preseed_debian-jessie.cfg.j2 delete mode 100644 roles/preseed/templates/preseed_debian-stretch.cfg.j2 delete mode 100644 roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 delete mode 100644 roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 delete mode 100644 roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 diff --git a/chaos-at-home/ch-atlas.yml b/chaos-at-home/ch-atlas.yml index 21c52da1..a1cd0b0c 100644 --- a/chaos-at-home/ch-atlas.yml +++ b/chaos-at-home/ch-atlas.yml @@ -5,4 +5,4 @@ - role: sshd - role: zsh - role: vm/host - - role: installer/debian + - role: installer/debian/base diff --git a/chaos-at-home/ch-gnocchi.yml b/chaos-at-home/ch-gnocchi.yml index 2ab51770..8a39ee19 100644 --- a/chaos-at-home/ch-gnocchi.yml +++ b/chaos-at-home/ch-gnocchi.yml @@ -6,8 +6,8 @@ - role: sshd - role: zsh - role: vm/host - - role: installer/debian - - role: installer/openbsd + - role: installer/debian/base + - role: installer/openbsd/base post_tasks: # you need to reboot for changes to take effect - name: install network interface config diff --git a/dan/sk-2019vm.yml b/dan/sk-2019vm.yml index bb7b7d76..cca2da5f 100644 --- a/dan/sk-2019vm.yml +++ b/dan/sk-2019vm.yml @@ -9,7 +9,7 @@ - role: cryptdisk - role: zfs/base - role: vm/host - - role: installer/debian + - role: installer/debian/base tasks: - name: install post-boot script copy: diff --git a/preseed/.gitignore b/preseed/.gitignore deleted file mode 100644 index 4f8f2ff1..00000000 --- a/preseed/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*-example.cfg -vm-*.cfg diff --git a/preseed/fetch-example.sh b/preseed/fetch-example.sh deleted file mode 100755 index fa89bdba..00000000 --- a/preseed/fetch-example.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ] && [ -z "$2" ]; then - echo "Usage: $0 " - exit 1 -fi - -distro="$1" -codename="$2" - -case "$distro" in - debian) - wget "https://www.debian.org/releases/$codename/example-preseed.txt" -O "$codename-example.cfg" - ;; - ubuntu) - rel="$codename" - case "$codename" in - xenial) - rel="16.04" - ;; - bionic) - rel="18.04" - ;; - esac - wget "https://help.ubuntu.com/$rel/installation-guide/example-preseed.txt" -O "$codename-example.cfg" - ;; -esac - -exit 0 diff --git a/preseed/hosts/Readme.md b/preseed/hosts/Readme.md deleted file mode 100644 index c6899a8d..00000000 --- a/preseed/hosts/Readme.md +++ /dev/null @@ -1,15 +0,0 @@ -# Preseed files for various hosts - -In order to fully automaticall install you need to start a temporay webserver using this directory as document root: - - python -m SimpleHTTPServer 8000 - -When this is done run the netinst image and intrd with the following boot command line: - - auto=true interface=auto url=http://:8000/dione_debian-stretch.cfg netcfg/choose_interface=eno1 netcfg/get_hostname=dione netcfg/get_domain=spreadspace.org - -This example assumes you want to install the host `dione`. -For debugging you may add the following to the kernel command line: - - DEBCONF_DEBUG=5 - diff --git a/preseed/hosts/calypso_debian-stretch.cfg b/preseed/hosts/calypso_debian-stretch.cfg deleted file mode 100644 index bf5f2f61..00000000 --- a/preseed/hosts/calypso_debian-stretch.cfg +++ /dev/null @@ -1,129 +0,0 @@ -######################################################################### -# spreadspace preseed file for Debian stretch based VMs -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string de_AT.UTF-8 -d-i keyboard-configuration/xkb-keymap select de - -# TODO: this does not work :(, probably adding it to the boot options will fix it -d-i hw-detect/load_firmware boolean false - -d-i netcfg/choose_interface select eno1 -d-i netcfg/disable_autoconfig boolean true - -d-i netcfg/get_hostname string calypso -d-i netcfg/get_domain string spreadspace.org -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string debian.ffgraz.net -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - -d-i preseed/early_command string h=$(hostname -s); d=$(hostname -d); sed s/$h/calypso/g -i /etc/hosts /etc/hostname; sed s/$d/spreadspace.org/g -i /etc/hosts; hostname calypso - -d-i passwd/make-user boolean false -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - -d-i partman-auto/disk string /dev/sda /dev/sdb -d-i partman-auto/method string raid -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string calypso - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true -d-i partman-md/confirm boolean true -d-i partman-md/confirm_nooverwrite boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -d-i partman/choose_label string dos -d-i partman/default_label string dos -d-i partman-auto/choose_recipe select boot-root -d-i partman-auto/expert_recipe string \ - boot-root :: \ - 256 512 256 raid \ - $lvmignore{ } $primary{ } \ - method{ raid } \ - . \ - 1000 10000 -1 raid \ - $lvmignore{ } $primary{ } \ - method{ raid } \ - . \ - 2560 10000 3072 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ calypso } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ calypso } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ calypso } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } \ - options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ calypso } \ - lv_name{ dummy } \ - . - -d-i partman-auto-raid/recipe string \ - 1 2 0 ext4 /boot \ - /dev/sda1#/dev/sdb1 \ - . \ - 1 2 0 lvm - \ - /dev/sda2#/dev/sdb2 \ - . - -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string debian.ffgraz.net - -tasksel tasksel/first multiselect -d-i pkgsel/include string openssh-server python -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false - -d-i grub-installer/choose_bootdev string /dev/sda /dev/sdb -d-i grub-installer/bootdev string /dev/sda /dev/sdb -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i nobootloader/confirmation_common boolean true - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f calypso/dummy; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ - in-target bash -c "sed 's#GRUB_CMDLINE_LINUX_DEFAULT.*#GRUB_CMDLINE_LINUX_DEFAULT=\"quiet nomodeset consoleblank=0\"#' -i /etc/default/grub && update-grub"; \ - in-target bash -c "passwd -d root; passwd -l root; umask 077; mkdir -p /root/.ssh/; echo -e 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCtmysXjBidEwJek6hBgaENiyVOwroFi19xRZZw+cYYqi6asDfF6B/h6gYNkJGWo0rD5ZaLdau1O210O5Xu+TfK1e2bZbxuFIj2fguUkat9wN6IQIO2m2Wcf4k/eiTmtAE3dp0l5ThMqfxxE8dj76mOOrUHCfJUIVoATGs4X5TLcGcXroAcZ+DFFoDzjxjFYNmIuUNtXDwXTpPc63SAYmRvW0ZYZlvH1qZ6irLh+GtE1dZ1Q5lQZvp6xUYcjInbpcd5Ko3KbG/In7sNmUCI7iaTwC4DPDTcHFj99Ll1jruAbdaQqe+ClZv55dbQ+92RDF6fsuQBD8FeRz7nYChvCqNPT1KOvcVsDtbW0iJ1PZ05QdE27w23wJj9OE0JWM09P3AH3ttswHaJ+P4s7mSxxK2m6YZcqop3czLlWWoGna0ynd5eV6l/rtvAQUvBOXjKQ5fPQY5d9cF0Z87NBE54HM9a/IKZ2toU2MuYNUpI/DUoAA9ILS4bJm3AUz8wbaC5EiuIhbM6I/u0NANamaQKRrolGNP4ETaQvhABs+S3/NSSBy4DMjtwax2BxyenF6i89vyHPNY+LZzBOn842yUlEGn6Z11MxiE5fhIfMPUclSYi5bQJDf1fvAyAo59/AX8sPqRK+/OCLIgLwdtW6D4OZGXjqrBJe2j/5uZSJEsl6ROyKw== equinox@spreadspace.org' > /root/.ssh/authorized_keys" diff --git a/preseed/hosts/dione_debian-stretch.cfg b/preseed/hosts/dione_debian-stretch.cfg deleted file mode 100644 index 8f989ff6..00000000 --- a/preseed/hosts/dione_debian-stretch.cfg +++ /dev/null @@ -1,114 +0,0 @@ -######################################################################### -# spreadspace preseed file for Debian stretch based VMs -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string de_AT.UTF-8 -d-i keyboard-configuration/xkb-keymap select de - - -d-i netcfg/choose_interface select eno1 -d-i netcfg/disable_autoconfig boolean true - -d-i netcfg/get_hostname string dione -d-i netcfg/get_domain string spreadspace.org -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string debian.ffgraz.net -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - -d-i preseed/early_command string h=$(hostname -s); d=$(hostname -d); sed s/$h/dione/g -i /etc/hosts /etc/hostname; sed s/$d/spreadspace.org/g -i /etc/hosts; hostname dione - -d-i passwd/make-user boolean false -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - -d-i partman-efi/non_efi_system boolean true -d-i partman-auto/disk string /dev/nvme0n1 -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string dione - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -d-i partman-auto/choose_recipe select boot-root -d-i partman-auto/expert_recipe string \ - boot-root :: \ - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } \ - $bootable{ } method{ efi } format{ } \ - . \ - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } \ - method{ lvm } vg_name{ dione } \ - . \ - 2560 10000 3072 ext4 \ - $lvmok{ } in_vg{ dione } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ dione } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ dione } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } \ - options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ dione } \ - method( keep } lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string debian.ffgraz.net - -tasksel tasksel/first multiselect -d-i pkgsel/include string openssh-server python -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false - -d-i grub-installer/choose_bootdev string /dev/nvme0n1 -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i nobootloader/confirmation_common boolean true - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f dione/dummy; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ - in-target bash -c "sed 's#GRUB_CMDLINE_LINUX_DEFAULT.*#GRUB_CMDLINE_LINUX_DEFAULT=\"quiet nomodeset consoleblank=0\"#' -i /etc/default/grub && update-grub"; \ - in-target bash -c "passwd -d root; passwd -l root; umask 077; mkdir -p /root/.ssh/; echo -e 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCtmysXjBidEwJek6hBgaENiyVOwroFi19xRZZw+cYYqi6asDfF6B/h6gYNkJGWo0rD5ZaLdau1O210O5Xu+TfK1e2bZbxuFIj2fguUkat9wN6IQIO2m2Wcf4k/eiTmtAE3dp0l5ThMqfxxE8dj76mOOrUHCfJUIVoATGs4X5TLcGcXroAcZ+DFFoDzjxjFYNmIuUNtXDwXTpPc63SAYmRvW0ZYZlvH1qZ6irLh+GtE1dZ1Q5lQZvp6xUYcjInbpcd5Ko3KbG/In7sNmUCI7iaTwC4DPDTcHFj99Ll1jruAbdaQqe+ClZv55dbQ+92RDF6fsuQBD8FeRz7nYChvCqNPT1KOvcVsDtbW0iJ1PZ05QdE27w23wJj9OE0JWM09P3AH3ttswHaJ+P4s7mSxxK2m6YZcqop3czLlWWoGna0ynd5eV6l/rtvAQUvBOXjKQ5fPQY5d9cF0Z87NBE54HM9a/IKZ2toU2MuYNUpI/DUoAA9ILS4bJm3AUz8wbaC5EiuIhbM6I/u0NANamaQKRrolGNP4ETaQvhABs+S3/NSSBy4DMjtwax2BxyenF6i89vyHPNY+LZzBOn842yUlEGn6Z11MxiE5fhIfMPUclSYi5bQJDf1fvAyAo59/AX8sPqRK+/OCLIgLwdtW6D4OZGXjqrBJe2j/5uZSJEsl6ROyKw== equinox@spreadspace.org' > /root/.ssh/authorized_keys" diff --git a/preseed/hosts/helene_debian-stretch.cfg b/preseed/hosts/helene_debian-stretch.cfg deleted file mode 100644 index b89e7326..00000000 --- a/preseed/hosts/helene_debian-stretch.cfg +++ /dev/null @@ -1,114 +0,0 @@ -######################################################################### -# spreadspace preseed file for Debian stretch based VMs -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string de_AT.UTF-8 -d-i keyboard-configuration/xkb-keymap select de - - -d-i netcfg/choose_interface select eno1 -d-i netcfg/disable_autoconfig boolean true - -d-i netcfg/get_hostname string helene -d-i netcfg/get_domain string spreadspace.org -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string debian.ffgraz.net -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - -d-i preseed/early_command string h=$(hostname -s); d=$(hostname -d); sed s/$h/helene/g -i /etc/hosts /etc/hostname; sed s/$d/spreadspace.org/g -i /etc/hosts; hostname helene - -d-i passwd/make-user boolean false -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - -d-i partman-efi/non_efi_system boolean true -d-i partman-auto/disk string /dev/nvme0n1 -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string helene - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -d-i partman-auto/choose_recipe select boot-root -d-i partman-auto/expert_recipe string \ - boot-root :: \ - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } \ - $bootable{ } method{ efi } format{ } \ - . \ - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } \ - method{ lvm } vg_name{ helene } \ - . \ - 2560 10000 3072 ext4 \ - $lvmok{ } in_vg{ helene } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ helene } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ helene } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } \ - options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ helene } \ - method( keep } lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string debian.ffgraz.net - -tasksel tasksel/first multiselect -d-i pkgsel/include string openssh-server python -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false - -d-i grub-installer/choose_bootdev string /dev/nvme0n1 -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i nobootloader/confirmation_common boolean true - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f helene/dummy; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ - in-target bash -c "sed 's#GRUB_CMDLINE_LINUX_DEFAULT.*#GRUB_CMDLINE_LINUX_DEFAULT=\"quiet nomodeset consoleblank=0\"#' -i /etc/default/grub && update-grub"; \ - in-target bash -c "passwd -d root; passwd -l root; umask 077; mkdir -p /root/.ssh/; echo -e 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCtmysXjBidEwJek6hBgaENiyVOwroFi19xRZZw+cYYqi6asDfF6B/h6gYNkJGWo0rD5ZaLdau1O210O5Xu+TfK1e2bZbxuFIj2fguUkat9wN6IQIO2m2Wcf4k/eiTmtAE3dp0l5ThMqfxxE8dj76mOOrUHCfJUIVoATGs4X5TLcGcXroAcZ+DFFoDzjxjFYNmIuUNtXDwXTpPc63SAYmRvW0ZYZlvH1qZ6irLh+GtE1dZ1Q5lQZvp6xUYcjInbpcd5Ko3KbG/In7sNmUCI7iaTwC4DPDTcHFj99Ll1jruAbdaQqe+ClZv55dbQ+92RDF6fsuQBD8FeRz7nYChvCqNPT1KOvcVsDtbW0iJ1PZ05QdE27w23wJj9OE0JWM09P3AH3ttswHaJ+P4s7mSxxK2m6YZcqop3czLlWWoGna0ynd5eV6l/rtvAQUvBOXjKQ5fPQY5d9cF0Z87NBE54HM9a/IKZ2toU2MuYNUpI/DUoAA9ILS4bJm3AUz8wbaC5EiuIhbM6I/u0NANamaQKRrolGNP4ETaQvhABs+S3/NSSBy4DMjtwax2BxyenF6i89vyHPNY+LZzBOn842yUlEGn6Z11MxiE5fhIfMPUclSYi5bQJDf1fvAyAo59/AX8sPqRK+/OCLIgLwdtW6D4OZGXjqrBJe2j/5uZSJEsl6ROyKw== equinox@spreadspace.org' > /root/.ssh/authorized_keys" diff --git a/preseed/hosts/telesto_debian-stretch.cfg b/preseed/hosts/telesto_debian-stretch.cfg deleted file mode 100644 index 5bbd382b..00000000 --- a/preseed/hosts/telesto_debian-stretch.cfg +++ /dev/null @@ -1,126 +0,0 @@ -######################################################################### -# spreadspace preseed file for Debian stretch based VMs -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string de_AT.UTF-8 -d-i keyboard-configuration/xkb-keymap select de - -d-i netcfg/choose_interface select eno1 -d-i netcfg/disable_autoconfig boolean true - -d-i netcfg/get_hostname string telesto -d-i netcfg/get_domain string spreadspace.org -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string debian.ffgraz.net -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - -d-i preseed/early_command string h=$(hostname -s); d=$(hostname -d); sed s/$h/telesto/g -i /etc/hosts /etc/hostname; sed s/$d/spreadspace.org/g -i /etc/hosts; hostname telesto - -d-i passwd/make-user boolean false -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - -d-i partman-auto/disk string /dev/sda /dev/sdb -d-i partman-auto/method string raid -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string telesto - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true -d-i partman-md/confirm boolean true -d-i partman-md/confirm_nooverwrite boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -d-i partman/choose_label string dos -d-i partman/default_label string dos -d-i partman-auto/choose_recipe select boot-root -d-i partman-auto/expert_recipe string \ - boot-root :: \ - 256 512 256 raid \ - $lvmignore{ } $primary{ } \ - method{ raid } \ - . \ - 1000 10000 -1 raid \ - $lvmignore{ } $primary{ } \ - method{ raid } \ - . \ - 2560 10000 3072 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ telesto } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ telesto } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ telesto } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } \ - options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ telesto } \ - lv_name{ dummy } \ - . - -d-i partman-auto-raid/recipe string \ - 1 2 0 ext4 /boot \ - /dev/sda1#/dev/sdb1 \ - . \ - 1 2 0 lvm - \ - /dev/sda2#/dev/sdb2 \ - . - -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string debian.ffgraz.net - -tasksel tasksel/first multiselect -d-i pkgsel/include string openssh-server python -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false - -d-i grub-installer/choose_bootdev string /dev/sda /dev/sdb -d-i grub-installer/bootdev string /dev/sda /dev/sdb -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i nobootloader/confirmation_common boolean true - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f telesto/dummy; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ - in-target bash -c "sed 's#GRUB_CMDLINE_LINUX_DEFAULT.*#GRUB_CMDLINE_LINUX_DEFAULT=\"quiet nomodeset consoleblank=0\"#' -i /etc/default/grub && update-grub"; \ - in-target bash -c "passwd -d root; passwd -l root; umask 077; mkdir -p /root/.ssh/; echo -e 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCtmysXjBidEwJek6hBgaENiyVOwroFi19xRZZw+cYYqi6asDfF6B/h6gYNkJGWo0rD5ZaLdau1O210O5Xu+TfK1e2bZbxuFIj2fguUkat9wN6IQIO2m2Wcf4k/eiTmtAE3dp0l5ThMqfxxE8dj76mOOrUHCfJUIVoATGs4X5TLcGcXroAcZ+DFFoDzjxjFYNmIuUNtXDwXTpPc63SAYmRvW0ZYZlvH1qZ6irLh+GtE1dZ1Q5lQZvp6xUYcjInbpcd5Ko3KbG/In7sNmUCI7iaTwC4DPDTcHFj99Ll1jruAbdaQqe+ClZv55dbQ+92RDF6fsuQBD8FeRz7nYChvCqNPT1KOvcVsDtbW0iJ1PZ05QdE27w23wJj9OE0JWM09P3AH3ttswHaJ+P4s7mSxxK2m6YZcqop3czLlWWoGna0ynd5eV6l/rtvAQUvBOXjKQ5fPQY5d9cF0Z87NBE54HM9a/IKZ2toU2MuYNUpI/DUoAA9ILS4bJm3AUz8wbaC5EiuIhbM6I/u0NANamaQKRrolGNP4ETaQvhABs+S3/NSSBy4DMjtwax2BxyenF6i89vyHPNY+LZzBOn842yUlEGn6Z11MxiE5fhIfMPUclSYi5bQJDf1fvAyAo59/AX8sPqRK+/OCLIgLwdtW6D4OZGXjqrBJe2j/5uZSJEsl6ROyKw== equinox@spreadspace.org' > /root/.ssh/authorized_keys" diff --git a/roles/installer/debian/base/defaults/main.yml b/roles/installer/debian/base/defaults/main.yml new file mode 100644 index 00000000..8962e9ad --- /dev/null +++ b/roles/installer/debian/base/defaults/main.yml @@ -0,0 +1,22 @@ +distros: + - distro: debian + codename: stretch + arch: + - amd64 + - i386 + - distro: debian + codename: buster + arch: + - amd64 + - i386 + + - distro: ubuntu + codename: bionic + arch: + - amd64 + - i386 + +debian_installer_force_download: no +debian_installer_url: + debian: "https://debian.ffgraz.net/debian" + ubuntu: "https://debian.ffgraz.net/ubuntu" diff --git a/roles/installer/debian/base/tasks/main.yml b/roles/installer/debian/base/tasks/main.yml new file mode 100644 index 00000000..92fac536 --- /dev/null +++ b/roles/installer/debian/base/tasks/main.yml @@ -0,0 +1,27 @@ +- name: prepare directories for installer images + loop: "{{ distros | subelements('arch') }}" + loop_control: + label: "{{ item.0.distro }}/{{ item.0.codename }} {{ item.1 }}" + file: + name: "{{ installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}" + state: directory + +- name: download installer kernel images + loop: "{{ distros | subelements('arch') }}" + loop_control: + label: "{{ item.0.distro }}/{{ item.0.codename }} {{ item.1 }}" + get_url: + url: "{{ debian_installer_url[item.0.distro] }}/dists/{{ item.0.codename }}/main/installer-{{ item.1 }}/current/images/netboot/{{ item.0.distro }}-installer/{{ item.1 }}/linux" + dest: "{{ installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/linux" + mode: 0644 + force: "{{ debian_installer_force_download }}" + +- name: download installer initrd.gz + loop: "{{ distros | subelements('arch') }}" + loop_control: + label: "{{ item.0.distro }}/{{ item.0.codename }} {{ item.1 }}" + get_url: + url: "{{ debian_installer_url[item.0.distro] }}/dists/{{ item.0.codename }}/main/installer-{{ item.1 }}/current/images/netboot/{{ item.0.distro }}-installer/{{ item.1 }}/initrd.gz" + dest: "{{ installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/initrd.gz" + mode: 0644 + force: "{{ debian_installer_force_download }}" diff --git a/roles/installer/debian/defaults/main.yml b/roles/installer/debian/defaults/main.yml deleted file mode 100644 index 8962e9ad..00000000 --- a/roles/installer/debian/defaults/main.yml +++ /dev/null @@ -1,22 +0,0 @@ -distros: - - distro: debian - codename: stretch - arch: - - amd64 - - i386 - - distro: debian - codename: buster - arch: - - amd64 - - i386 - - - distro: ubuntu - codename: bionic - arch: - - amd64 - - i386 - -debian_installer_force_download: no -debian_installer_url: - debian: "https://debian.ffgraz.net/debian" - ubuntu: "https://debian.ffgraz.net/ubuntu" diff --git a/roles/installer/debian/preseed/defaults/main.yml b/roles/installer/debian/preseed/defaults/main.yml new file mode 100644 index 00000000..c5400493 --- /dev/null +++ b/roles/installer/debian/preseed/defaults/main.yml @@ -0,0 +1,4 @@ +--- +#preseed_force_net_ifnames_policy: path + +preseed_no_netplan: no diff --git a/roles/installer/debian/preseed/tasks/main.yml b/roles/installer/debian/preseed/tasks/main.yml new file mode 100644 index 00000000..b1b5d275 --- /dev/null +++ b/roles/installer/debian/preseed/tasks/main.yml @@ -0,0 +1,47 @@ +--- +- name: Copy initramfs into position + copy: + remote_src: yes + src: "{{ installer_path | mandatory }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/initrd.gz" + dest: "{{ preseed_tmpdir }}/initrd.preseed.gz" + +- name: Generate preseed file + template: + src: "preseed_{{ hostvars[hostname].preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2" + dest: "{{ preseed_tmpdir }}/preseed.cfg" + +- name: Generate authorized_keys file + authorized_key: + user: root + manage_dir: no + path: "{{ preseed_tmpdir }}/authorized_keys" + key: "{{ ssh_keys_root | join('\n') }}" + +- name: force net interface name policy + when: preseed_force_net_ifnames_policy is defined + block: + - name: prepare directories to force network interface name policy + file: + path: "{{ preseed_tmpdir }}/etc/systemd/network" + state: directory + + - name: install link unit to force network interface name policy + copy: + dest: "{{ preseed_tmpdir }}/etc/systemd/network/90-namepolicy.link" + content: | + [Link] + NamePolicy={{ preseed_force_net_ifnames_policy }} + +- name: Inject files into initramfs + shell: cpio -H newc -o | gzip -9 >> 'initrd.preseed.gz' + args: + chdir: "{{ preseed_tmpdir }}" + stdin: | + preseed.cfg + authorized_keys + etc/ + etc/systemd/ + etc/systemd/network/ + etc/systemd/network/90-namepolicy.link + tags: + - skip_ansible_lint diff --git a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 new file mode 100644 index 00000000..9952fa0a --- /dev/null +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 @@ -0,0 +1,147 @@ +######################################################################### +# spreadspace preseed file for Debian buster based VMs +######################################################################### + +d-i debian-installer/language string en +d-i debian-installer/country string AT +d-i debian-installer/locale string en_US.UTF-8 +d-i keyboard-configuration/xkb-keymap select us + +d-i hw-detect/load_firmware boolean false + +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/disable_dhcp boolean false +d-i netcfg/disable_autoconfig boolean false +{% else %} +d-i netcfg/disable_dhcp boolean true +d-i netcfg/disable_autoconfig boolean true +d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/confirm_static boolean true +{% endif %} + +d-i netcfg/hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/wireless_wep string + + +d-i mirror/country string manual +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} +d-i mirror/http/directory string /debian +d-i mirror/http/proxy string + + +d-i passwd/make-user boolean false +d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand +d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand + + +d-i clock-setup/utc boolean true +d-i time/zone string Europe/Vienna +d-i clock-setup/ntp boolean false + + +d-i partman/early_command string \ + debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + umount -l /media || true + +d-i grub-installer/choose_bootdev string manual +d-i grub-installer/bootdev seen true + +d-i partman-auto/method string lvm +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} +d-i partman-auto-lvm/guided_size string max + +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true + +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +{% if (hostvars[hostname].install_cooked.efi | default(false)) %} +d-i partman-efi/non_efi_system boolean true +d-i partman/choose_label string gpt +d-i partman/default_label string gpt +{% endif %} +d-i partman-auto/expert_recipe string \ + boot-root :: \ +{% if (hostvars[hostname].install_cooked.efi | default(false)) %} + 100 100 128 fat16 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ efi } format{ } \ + . \ +{% endif %} + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[hostname].host_name }} } \ + . \ + 2048 10000 2560 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1024 11000 1280 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 768 10000 768 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var/log } \ + options/nodev{ nodev } options/noatime{ noatime } \ + options/noexec{ noexec } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + lv_name{ dummy } \ + . + +d-i partman-auto-lvm/no_boot boolean true +d-i partman-basicfilesystems/no_swap true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + + +d-i base-installer/install-recommends boolean false +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} + +tasksel tasksel/first multiselect +d-i pkgsel/include string openssh-server python python-apt +d-i pkgsel/upgrade select safe-upgrade +popularity-contest popularity-contest/participate boolean false + +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean false + +d-i finish-install/reboot_in_progress note + + +d-i preseed/late_command string \ + lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ + in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ +{% if preseed_force_net_ifnames_policy is defined %} + mkdir -p /target/etc/systemd/network; \ + in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "update-initramfs -u"; \ +{% endif %} + in-target bash -c "passwd -d root && passwd -l root"; \ +{% if hostvars[hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% endif %} + mkdir -p -m 0700 /target/root/.ssh; \ + cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 new file mode 100644 index 00000000..4519d910 --- /dev/null +++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 @@ -0,0 +1,147 @@ +######################################################################### +# spreadspace preseed file for Debian jessie based VMs +######################################################################### + +d-i debian-installer/language string en +d-i debian-installer/country string AT +d-i debian-installer/locale string en_US.UTF-8 +d-i keyboard-configuration/xkb-keymap select us + +d-i hw-detect/load_firmware boolean false + +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/disable_dhcp boolean false +d-i netcfg/disable_autoconfig boolean false +{% else %} +d-i netcfg/disable_dhcp boolean true +d-i netcfg/disable_autoconfig boolean true +d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/confirm_static boolean true +{% endif %} + +d-i netcfg/hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/wireless_wep string + + +d-i mirror/country string manual +d-i mirror/http/hostname string archive.debian.org +d-i mirror/http/directory string /debian +d-i mirror/http/proxy string + + +d-i passwd/make-user boolean false +d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand +d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand + + +d-i clock-setup/utc boolean true +d-i time/zone string Europe/Vienna +d-i clock-setup/ntp boolean false + + +d-i partman/early_command string \ + debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + umount -l /media || true + +d-i grub-installer/choose_bootdev string manual +d-i grub-installer/bootdev seen true + +d-i partman-auto/method string lvm +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} +d-i partman-auto-lvm/guided_size string max + +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true + +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +{% if (hostvars[hostname].install_cooked.efi | default(false)) %} +d-i partman-efi/non_efi_system boolean true +d-i partman/choose_label string gpt +d-i partman/default_label string gpt +{% endif %} +d-i partman-auto/expert_recipe string \ + boot-root :: \ +{% if (hostvars[hostname].install_cooked.efi | default(false)) %} + 100 100 128 fat16 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ efi } format{ } \ + . \ +{% endif %} + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[hostname].host_name }} } \ + . \ + 2048 10000 2560 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1024 11000 1280 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 768 10000 768 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var/log } \ + options/nodev{ nodev } options/noatime{ noatime } \ + options/noexec{ noexec } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + lv_name{ dummy } \ + . + +d-i partman-auto-lvm/no_boot boolean true +d-i partman-basicfilesystems/no_swap true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + + +d-i base-installer/install-recommends boolean false +d-i apt-setup/security_host string + +tasksel tasksel/first multiselect +d-i pkgsel/include string openssh-server python python-apt +d-i pkgsel/upgrade select safe-upgrade +popularity-contest popularity-contest/participate boolean false + +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean false + +d-i finish-install/reboot_in_progress note + + +d-i preseed/late_command string \ + lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ + in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ +{% if preseed_force_net_ifnames_policy is defined %} + mkdir -p /target/etc/systemd/network; \ + in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "update-initramfs -u"; \ +{% endif %} + in-target bash -c "passwd -d root && passwd -l root"; \ +{% if hostvars[hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% endif %} + mkdir -p -m 0700 /target/root/.ssh; \ + cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 new file mode 100644 index 00000000..8969fa7c --- /dev/null +++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -0,0 +1,147 @@ +######################################################################### +# spreadspace preseed file for Debian stretch based VMs +######################################################################### + +d-i debian-installer/language string en +d-i debian-installer/country string AT +d-i debian-installer/locale string en_US.UTF-8 +d-i keyboard-configuration/xkb-keymap select us + +d-i hw-detect/load_firmware boolean false + +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/disable_dhcp boolean false +d-i netcfg/disable_autoconfig boolean false +{% else %} +d-i netcfg/disable_dhcp boolean true +d-i netcfg/disable_autoconfig boolean true +d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/confirm_static boolean true +{% endif %} + +d-i netcfg/hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/wireless_wep string + + +d-i mirror/country string manual +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} +d-i mirror/http/directory string /debian +d-i mirror/http/proxy string + + +d-i passwd/make-user boolean false +d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand +d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand + + +d-i clock-setup/utc boolean true +d-i time/zone string Europe/Vienna +d-i clock-setup/ntp boolean false + + +d-i partman/early_command string \ + debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + umount -l /media || true + +d-i grub-installer/choose_bootdev string manual +d-i grub-installer/bootdev seen true + +d-i partman-auto/method string lvm +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} +d-i partman-auto-lvm/guided_size string max + +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true + +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +{% if (hostvars[hostname].install_cooked.efi | default(false)) %} +d-i partman-efi/non_efi_system boolean true +d-i partman/choose_label string gpt +d-i partman/default_label string gpt +{% endif %} +d-i partman-auto/expert_recipe string \ + boot-root :: \ +{% if (hostvars[hostname].install_cooked.efi | default(false)) %} + 100 100 128 fat16 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ efi } format{ } \ + . \ +{% endif %} + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[hostname].host_name }} } \ + . \ + 2048 10000 2560 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1024 11000 1280 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 768 10000 768 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var/log } \ + options/nodev{ nodev } options/noatime{ noatime } \ + options/noexec{ noexec } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + lv_name{ dummy } \ + . + +d-i partman-auto-lvm/no_boot boolean true +d-i partman-basicfilesystems/no_swap true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + + +d-i base-installer/install-recommends boolean false +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} + +tasksel tasksel/first multiselect +d-i pkgsel/include string openssh-server python python-apt +d-i pkgsel/upgrade select safe-upgrade +popularity-contest popularity-contest/participate boolean false + +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean false + +d-i finish-install/reboot_in_progress note + + +d-i preseed/late_command string \ + lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ + in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ +{% if preseed_force_net_ifnames_policy is defined %} + mkdir -p /target/etc/systemd/network; \ + in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "update-initramfs -u"; \ +{% endif %} + in-target bash -c "passwd -d root && passwd -l root"; \ +{% if hostvars[hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% endif %} + mkdir -p -m 0700 /target/root/.ssh; \ + cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 new file mode 100644 index 00000000..a2fffd11 --- /dev/null +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -0,0 +1,160 @@ +######################################################################### +# spreadspace preseed file for Ubuntu bionic based VMs +######################################################################### + +d-i debian-installer/language string en +d-i debian-installer/country string AT +d-i debian-installer/locale string en_US.UTF-8 +d-i localechooser/preferred-locale string en_US.UTF-8 +d-i localechooser/supported-locales multiselect de_DE.UTF-8, de_AT.UTF-8 +d-i console-setup/ask_detect boolean false +d-i keyboard-configuration/xkb-keymap select us +d-i keyboard-configuration/layoutcode string us + +d-i hw-detect/load_firmware boolean false + +{% if preseed_no_netplan %} +d-i netcfg/do_not_use_netplan boolean true +{% endif %} +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/disable_dhcp boolean false +d-i netcfg/disable_autoconfig boolean false +{% else %} +d-i netcfg/disable_dhcp boolean true +d-i netcfg/disable_autoconfig boolean true +d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/confirm_static boolean true +{% endif %} + +d-i netcfg/hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/wireless_wep string + + +d-i mirror/country string manual +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} +d-i mirror/http/directory string /ubuntu +d-i mirror/http/proxy string + + +d-i passwd/make-user boolean false +d-i passwd/root-login boolean true +d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand +d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand + + +d-i clock-setup/utc boolean true +d-i time/zone string Europe/Vienna +d-i clock-setup/ntp boolean false + + +d-i partman/early_command string \ + debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + umount -l /media || true + +d-i grub-installer/choose_bootdev string manual +d-i grub-installer/bootdev seen true + +d-i partman-auto/method string lvm +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} +d-i partman-auto-lvm/guided_size string max + +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true + +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +{% if (hostvars[hostname].install_cooked.efi | default(false)) %} +d-i partman-efi/non_efi_system boolean true +d-i partman/choose_label string gpt +d-i partman/default_label string gpt +{% endif %} +d-i partman-auto/expert_recipe string \ + boot-root :: \ +{% if (hostvars[hostname].install_cooked.efi | default(false)) %} + 100 100 128 fat16 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ efi } format{ } \ + . \ +{% endif %} + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[hostname].host_name }} } \ + . \ + 2048 10000 2560 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1024 11000 1280 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 768 10000 768 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var/log } \ + options/nodev{ nodev } options/noatime{ noatime } \ + options/noexec{ noexec } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + lv_name{ dummy } \ + . + +d-i partman-auto-lvm/no_boot boolean true +d-i partman-basicfilesystems/no_swap true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + + +d-i base-installer/install-recommends boolean false +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} + +tasksel tasksel/first multiselect +d-i pkgsel/include string openssh-server python python-apt ifupdown +d-i pkgsel/upgrade select safe-upgrade +popularity-contest popularity-contest/participate boolean false +d-i pkgsel/update-policy select none + +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean false + +d-i finish-install/reboot_in_progress note + + +d-i preseed/late_command string \ + lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + in-target bash -c "swapoff -a; sed -e '/^\/swapfile/d' -i /etc/fstab; rm -f /swapfile"; \ + in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ +{% if preseed_no_netplan %} + in-target bash -c "apt-get purge -y -q netplan.io && apt-get autoremove -y -q && rm -rf /etc/netplan"; \ +{% endif %} + in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ +{% if preseed_force_net_ifnames_policy is defined %} + mkdir -p /target/etc/systemd/network; \ + in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "update-initramfs -u"; \ +{% endif %} + in-target bash -c "passwd -d root && passwd -l root"; \ +{% if hostvars[hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% endif %} + mkdir -p -m 0700 /target/root/.ssh; \ + cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 new file mode 100644 index 00000000..0b3d3698 --- /dev/null +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -0,0 +1,153 @@ +######################################################################### +# spreadspace preseed file for Ubuntu xenial based VMs +######################################################################### + +d-i debian-installer/language string en +d-i debian-installer/country string AT +d-i debian-installer/locale string en_US.UTF-8 +d-i localechooser/preferred-locale string en_US.UTF-8 +d-i localechooser/supported-locales multiselect de_DE.UTF-8, de_AT.UTF-8 +d-i console-setup/ask_detect boolean false +d-i keyboard-configuration/xkb-keymap select us +d-i keyboard-configuration/layoutcode string us + +d-i hw-detect/load_firmware boolean false + +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/disable_dhcp boolean false +d-i netcfg/disable_autoconfig boolean false +{% else %} +d-i netcfg/disable_dhcp boolean true +d-i netcfg/disable_autoconfig boolean true +d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/confirm_static boolean true +{% endif %} + +d-i netcfg/hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/wireless_wep string + + +d-i mirror/country string manual +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} +d-i mirror/http/directory string /ubuntu +d-i mirror/http/proxy string + + +d-i passwd/make-user boolean false +d-i passwd/root-login boolean true +d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand +d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand + + +d-i clock-setup/utc boolean true +d-i time/zone string Europe/Vienna +d-i clock-setup/ntp boolean false + + +d-i partman/early_command string \ + debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + umount -l /media || true + +d-i grub-installer/choose_bootdev string manual +d-i grub-installer/bootdev seen true + +d-i partman-auto/method string lvm +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} +d-i partman-auto-lvm/guided_size string max + +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true + +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +{% if (hostvars[hostname].install_cooked.efi | default(false)) %} +d-i partman-efi/non_efi_system boolean true +d-i partman/choose_label string gpt +d-i partman/default_label string gpt +{% endif %} +d-i partman-auto/expert_recipe string \ + boot-root :: \ +{% if (hostvars[hostname].install_cooked.efi | default(false)) %} + 100 100 128 fat16 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ efi } format{ } \ + . \ +{% endif %} + 1000 10000 -1 ext4 \ + $defaultignore{ } $primary{ } $bootable{ } \ + method{ lvm } vg_name{ {{ hostvars[hostname].host_name }} } \ + . \ + 2048 10000 2560 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1024 11000 1280 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 768 10000 768 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var/log } \ + options/nodev{ nodev } options/noatime{ noatime } \ + options/noexec{ noexec } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ + lv_name{ dummy } \ + . + +d-i partman-auto-lvm/no_boot boolean true +d-i partman-basicfilesystems/no_swap true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + + +d-i base-installer/install-recommends boolean false +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} + +tasksel tasksel/first multiselect +d-i pkgsel/include string openssh-server python python-apt +d-i pkgsel/upgrade select safe-upgrade +popularity-contest popularity-contest/participate boolean false +d-i pkgsel/update-policy select none + +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean false + +d-i finish-install/reboot_in_progress note + + +d-i preseed/late_command string \ + lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ + in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ +{% if preseed_force_net_ifnames_policy is defined %} + mkdir -p /target/etc/systemd/network; \ + in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "update-initramfs -u"; \ +{% endif %} + in-target bash -c "passwd -d root && passwd -l root"; \ +{% if hostvars[hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% endif %} + mkdir -p -m 0700 /target/root/.ssh; \ + cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 new file mode 100644 index 00000000..22f47ce7 --- /dev/null +++ b/roles/installer/debian/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 @@ -0,0 +1,166 @@ +######################################################################### +# spreadspace preseed file for Ubuntu cosmic based Workstations +######################################################################### + +d-i debian-installer/language string en +d-i debian-installer/country string AT +d-i debian-installer/locale string de_AT.UTF-8 +d-i localechooser/preferred-locale string de_AT.UTF-8 +d-i localechooser/supported-locales multiselect de_DE.UTF-8, en_US.UTF-8 +d-i keyboard-configuration/xkb-keymap select de +## TODO: this still doesn't work properly... +d-i keyboard-configuration/layout select German (Austria) +d-i keyboard-configuration/layoutcode string at +d-i keyboard-configuration/layoutcode string nodeadkeys +d-i console-setup/ask_detect boolean false + +d-i hw-detect/load_firmware boolean false + +{% if preseed_no_netplan %} +d-i netcfg/do_not_use_netplan boolean true +{% endif %} +d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/disable_dhcp boolean false +d-i netcfg/disable_autoconfig boolean false +{% else %} +d-i netcfg/disable_dhcp boolean true +d-i netcfg/disable_autoconfig boolean true +d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} +d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} +d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} +d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} +d-i netcfg/confirm_static boolean true +{% endif %} + +d-i netcfg/hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} +d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} +d-i netcfg/wireless_wep string + + +d-i mirror/country string manual +d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} +d-i mirror/http/directory string /ubuntu +d-i mirror/http/proxy string + + +d-i passwd/make-user boolean false +d-i passwd/root-login boolean true +d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand +d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand + + +d-i clock-setup/utc boolean true +d-i time/zone string Europe/Vienna +d-i clock-setup/ntp boolean false + +d-i partman-auto/disk string /dev/sda /dev/sdb + +d-i partman-auto/method string raid +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} +d-i partman-auto-lvm/guided_size string max + +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-md/confirm boolean true +d-i partman-md/confirm_nooverwrite boolean true +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +d-i partman/choose_label string dos +d-i partman/default_label string dos +d-i partman-auto/choose_recipe select boot-root +d-i partman-auto/expert_recipe string \ + boot-root :: \ + 256 512 256 raid \ + $lvmignore{ } $primary{ } method{ raid } \ + . \ + 1000 10000 -1 raid \ + $lvmignore{ } $primary{ } method{ raid } \ + . \ + 15360 10000 20480 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 768 10000 768 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var/log } \ + options/nodev{ nodev } options/noatime{ noatime } \ + options/noexec{ noexec } \ + . \ + 20480 10000 20480 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /home } \ + . \ + 16 20000 -1 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[hostname].host_name }} } \ + lv_name{ dummy } \ + . + +d-i partman-auto-raid/recipe string \ + 1 2 0 ext4 /boot \ + /dev/sda1#/dev/sdb1 \ + . \ + 1 2 0 lvm - \ + /dev/sda2#/dev/sdb2 \ + . + +d-i partman-basicfilesystems/no_swap true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + + +d-i base-installer/install-recommends boolean false +d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} + +tasksel tasksel/first multiselect xubuntu-desktop +d-i pkgsel/include string openssh-server python python-apt ifupdown +d-i pkgsel/upgrade select safe-upgrade +popularity-contest popularity-contest/participate boolean false +d-i pkgsel/update-policy select none + +d-i grub-installer/choose_bootdev string /dev/sda /dev/sdb +d-i grub-installer/bootdev string /dev/sda /dev/sdb +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean false + +d-i nobootloader/confirmation_common boolean true + +d-i finish-install/reboot_in_progress note + + +d-i preseed/late_command string \ + lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ + in-target bash -c "swapoff -a; sed -e '/^\/swapfile/d' -i /etc/fstab; rm -f /swapfile"; \ + in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ +{% if preseed_no_netplan %} + in-target bash -c "apt-get purge -y -q netplan.io && apt-get autoremove -y -q && rm -rf /etc/netplan"; \ +{% endif %} + in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ +{% if preseed_force_net_ifnames_policy is defined %} + mkdir -p /target/etc/systemd/network; \ + in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ + in-target bash -c "update-initramfs -u"; \ +{% endif %} + in-target bash -c "passwd -d root && passwd -l root"; \ +{% if hostvars[hostname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ +{% endif %} + mkdir -p -m 0700 /target/root/.ssh; \ + cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/tasks/main.yml b/roles/installer/debian/tasks/main.yml deleted file mode 100644 index 92fac536..00000000 --- a/roles/installer/debian/tasks/main.yml +++ /dev/null @@ -1,27 +0,0 @@ -- name: prepare directories for installer images - loop: "{{ distros | subelements('arch') }}" - loop_control: - label: "{{ item.0.distro }}/{{ item.0.codename }} {{ item.1 }}" - file: - name: "{{ installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}" - state: directory - -- name: download installer kernel images - loop: "{{ distros | subelements('arch') }}" - loop_control: - label: "{{ item.0.distro }}/{{ item.0.codename }} {{ item.1 }}" - get_url: - url: "{{ debian_installer_url[item.0.distro] }}/dists/{{ item.0.codename }}/main/installer-{{ item.1 }}/current/images/netboot/{{ item.0.distro }}-installer/{{ item.1 }}/linux" - dest: "{{ installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/linux" - mode: 0644 - force: "{{ debian_installer_force_download }}" - -- name: download installer initrd.gz - loop: "{{ distros | subelements('arch') }}" - loop_control: - label: "{{ item.0.distro }}/{{ item.0.codename }} {{ item.1 }}" - get_url: - url: "{{ debian_installer_url[item.0.distro] }}/dists/{{ item.0.codename }}/main/installer-{{ item.1 }}/current/images/netboot/{{ item.0.distro }}-installer/{{ item.1 }}/initrd.gz" - dest: "{{ installer_path }}/{{ item.0.distro }}-{{ item.0.codename }}/{{ item.1 }}/initrd.gz" - mode: 0644 - force: "{{ debian_installer_force_download }}" diff --git a/roles/installer/openbsd/base/defaults/main.yml b/roles/installer/openbsd/base/defaults/main.yml new file mode 100644 index 00000000..6650e064 --- /dev/null +++ b/roles/installer/openbsd/base/defaults/main.yml @@ -0,0 +1,8 @@ +openbsd_versions: + - version: 6.6 + arch: + - amd64 + - i386 + +openbsd_installer_force_download: no +openbsd_installer_url: "https://ftp2.eu.openbsd.org/pub/OpenBSD/" diff --git a/roles/installer/openbsd/base/tasks/main.yml b/roles/installer/openbsd/base/tasks/main.yml new file mode 100644 index 00000000..fcc79589 --- /dev/null +++ b/roles/installer/openbsd/base/tasks/main.yml @@ -0,0 +1,42 @@ +- name: prepare directories for installer isos + loop: "{{ openbsd_versions | subelements('arch') }}" + loop_control: + label: "openbsd-{{ item.0.version }} {{ item.1 }}" + file: + name: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" + state: directory + +- name: download installer isos + loop: "{{ openbsd_versions | subelements('arch') }}" + loop_control: + label: "openbsd-{{ item.0.version }} {{ item.1 }}" + get_url: + url: "{{ openbsd_installer_url }}/{{ item.0.version }}/{{ item.1 }}/cd{{ item.0.version | replace('.', '') }}.iso" + dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd-orig.iso" + mode: 0644 + force: "{{ openbsd_installer_force_download }}" + +- name: install geniosimage + apt: + name: geniosimage + state: present + +## TODO +# - iso_extract from cd-orig.iso -> <>/<>/{boot.catalog,cdbr,cdboot,bsd.rd}, etc/boot.conf +# - add lines to etc/boot.conf -> stty com0 115200, set tty com0 +# - generate etc/auto_install.conf +# - name: generate host specific installer image +# loop: "{{ openbsd_versions | subelements('arch') }}" +# loop_control: +# label: "openbsd-{{ item.0.version }} {{ item.1 }}" +# command: 'genisoimage -RTLldDN -o "cd-{{ ansible_nodename }}.iso" -no-emul-boot -b "{{ item.0.version }}/{{ item.1 }}/cdbr" -c "{{ item.0.version }}/{{ item.1 }}/boot.catalog" data-{{ ansible_nodename }}/' +# args: +# chdir: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" +# +# - print instructions +# * attach to console +# * select (S)hell +# * # mount_cd9660 /dev/cd0c /mnt +# * # cp /mnt/etc/auto_install.conf / +# * # autoinstall +# diff --git a/roles/installer/openbsd/defaults/main.yml b/roles/installer/openbsd/defaults/main.yml deleted file mode 100644 index 6650e064..00000000 --- a/roles/installer/openbsd/defaults/main.yml +++ /dev/null @@ -1,8 +0,0 @@ -openbsd_versions: - - version: 6.6 - arch: - - amd64 - - i386 - -openbsd_installer_force_download: no -openbsd_installer_url: "https://ftp2.eu.openbsd.org/pub/OpenBSD/" diff --git a/roles/installer/openbsd/tasks/main.yml b/roles/installer/openbsd/tasks/main.yml deleted file mode 100644 index fcc79589..00000000 --- a/roles/installer/openbsd/tasks/main.yml +++ /dev/null @@ -1,42 +0,0 @@ -- name: prepare directories for installer isos - loop: "{{ openbsd_versions | subelements('arch') }}" - loop_control: - label: "openbsd-{{ item.0.version }} {{ item.1 }}" - file: - name: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" - state: directory - -- name: download installer isos - loop: "{{ openbsd_versions | subelements('arch') }}" - loop_control: - label: "openbsd-{{ item.0.version }} {{ item.1 }}" - get_url: - url: "{{ openbsd_installer_url }}/{{ item.0.version }}/{{ item.1 }}/cd{{ item.0.version | replace('.', '') }}.iso" - dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd-orig.iso" - mode: 0644 - force: "{{ openbsd_installer_force_download }}" - -- name: install geniosimage - apt: - name: geniosimage - state: present - -## TODO -# - iso_extract from cd-orig.iso -> <>/<>/{boot.catalog,cdbr,cdboot,bsd.rd}, etc/boot.conf -# - add lines to etc/boot.conf -> stty com0 115200, set tty com0 -# - generate etc/auto_install.conf -# - name: generate host specific installer image -# loop: "{{ openbsd_versions | subelements('arch') }}" -# loop_control: -# label: "openbsd-{{ item.0.version }} {{ item.1 }}" -# command: 'genisoimage -RTLldDN -o "cd-{{ ansible_nodename }}.iso" -no-emul-boot -b "{{ item.0.version }}/{{ item.1 }}/cdbr" -c "{{ item.0.version }}/{{ item.1 }}/boot.catalog" data-{{ ansible_nodename }}/' -# args: -# chdir: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" -# -# - print instructions -# * attach to console -# * select (S)hell -# * # mount_cd9660 /dev/cd0c /mnt -# * # cp /mnt/etc/auto_install.conf / -# * # autoinstall -# diff --git a/roles/preseed/defaults/main.yml b/roles/preseed/defaults/main.yml deleted file mode 100644 index c5400493..00000000 --- a/roles/preseed/defaults/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -#preseed_force_net_ifnames_policy: path - -preseed_no_netplan: no diff --git a/roles/preseed/tasks/main.yml b/roles/preseed/tasks/main.yml deleted file mode 100644 index b1b5d275..00000000 --- a/roles/preseed/tasks/main.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- name: Copy initramfs into position - copy: - remote_src: yes - src: "{{ installer_path | mandatory }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[hostname].install_cooked.arch | default('amd64') }}/initrd.gz" - dest: "{{ preseed_tmpdir }}/initrd.preseed.gz" - -- name: Generate preseed file - template: - src: "preseed_{{ hostvars[hostname].preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2" - dest: "{{ preseed_tmpdir }}/preseed.cfg" - -- name: Generate authorized_keys file - authorized_key: - user: root - manage_dir: no - path: "{{ preseed_tmpdir }}/authorized_keys" - key: "{{ ssh_keys_root | join('\n') }}" - -- name: force net interface name policy - when: preseed_force_net_ifnames_policy is defined - block: - - name: prepare directories to force network interface name policy - file: - path: "{{ preseed_tmpdir }}/etc/systemd/network" - state: directory - - - name: install link unit to force network interface name policy - copy: - dest: "{{ preseed_tmpdir }}/etc/systemd/network/90-namepolicy.link" - content: | - [Link] - NamePolicy={{ preseed_force_net_ifnames_policy }} - -- name: Inject files into initramfs - shell: cpio -H newc -o | gzip -9 >> 'initrd.preseed.gz' - args: - chdir: "{{ preseed_tmpdir }}" - stdin: | - preseed.cfg - authorized_keys - etc/ - etc/systemd/ - etc/systemd/network/ - etc/systemd/network/90-namepolicy.link - tags: - - skip_ansible_lint diff --git a/roles/preseed/templates/preseed_debian-buster.cfg.j2 b/roles/preseed/templates/preseed_debian-buster.cfg.j2 deleted file mode 100644 index 9952fa0a..00000000 --- a/roles/preseed/templates/preseed_debian-buster.cfg.j2 +++ /dev/null @@ -1,147 +0,0 @@ -######################################################################### -# spreadspace preseed file for Debian buster based VMs -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string en_US.UTF-8 -d-i keyboard-configuration/xkb-keymap select us - -d-i hw-detect/load_firmware boolean false - -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} -d-i netcfg/disable_dhcp boolean false -d-i netcfg/disable_autoconfig boolean false -{% else %} -d-i netcfg/disable_dhcp boolean true -d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} -d-i netcfg/confirm_static boolean true -{% endif %} - -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - - -d-i passwd/make-user boolean false -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - - -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true - -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} - -tasksel tasksel/first multiselect -d-i pkgsel/include string openssh-server python python-apt -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false - -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ - in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ -{% if preseed_force_net_ifnames_policy is defined %} - mkdir -p /target/etc/systemd/network; \ - in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "update-initramfs -u"; \ -{% endif %} - in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ -{% endif %} - mkdir -p -m 0700 /target/root/.ssh; \ - cp /authorized_keys /target/root/.ssh/ diff --git a/roles/preseed/templates/preseed_debian-jessie.cfg.j2 b/roles/preseed/templates/preseed_debian-jessie.cfg.j2 deleted file mode 100644 index 4519d910..00000000 --- a/roles/preseed/templates/preseed_debian-jessie.cfg.j2 +++ /dev/null @@ -1,147 +0,0 @@ -######################################################################### -# spreadspace preseed file for Debian jessie based VMs -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string en_US.UTF-8 -d-i keyboard-configuration/xkb-keymap select us - -d-i hw-detect/load_firmware boolean false - -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} -d-i netcfg/disable_dhcp boolean false -d-i netcfg/disable_autoconfig boolean false -{% else %} -d-i netcfg/disable_dhcp boolean true -d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} -d-i netcfg/confirm_static boolean true -{% endif %} - -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string archive.debian.org -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - - -d-i passwd/make-user boolean false -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - - -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true - -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string - -tasksel tasksel/first multiselect -d-i pkgsel/include string openssh-server python python-apt -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false - -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ - in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ -{% if preseed_force_net_ifnames_policy is defined %} - mkdir -p /target/etc/systemd/network; \ - in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "update-initramfs -u"; \ -{% endif %} - in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ -{% endif %} - mkdir -p -m 0700 /target/root/.ssh; \ - cp /authorized_keys /target/root/.ssh/ diff --git a/roles/preseed/templates/preseed_debian-stretch.cfg.j2 b/roles/preseed/templates/preseed_debian-stretch.cfg.j2 deleted file mode 100644 index 8969fa7c..00000000 --- a/roles/preseed/templates/preseed_debian-stretch.cfg.j2 +++ /dev/null @@ -1,147 +0,0 @@ -######################################################################### -# spreadspace preseed file for Debian stretch based VMs -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string en_US.UTF-8 -d-i keyboard-configuration/xkb-keymap select us - -d-i hw-detect/load_firmware boolean false - -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} -d-i netcfg/disable_dhcp boolean false -d-i netcfg/disable_autoconfig boolean false -{% else %} -d-i netcfg/disable_dhcp boolean true -d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} -d-i netcfg/confirm_static boolean true -{% endif %} - -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - - -d-i passwd/make-user boolean false -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - - -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true - -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].debian }} - -tasksel tasksel/first multiselect -d-i pkgsel/include string openssh-server python python-apt -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false - -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ - in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ -{% if preseed_force_net_ifnames_policy is defined %} - mkdir -p /target/etc/systemd/network; \ - in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "update-initramfs -u"; \ -{% endif %} - in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ -{% endif %} - mkdir -p -m 0700 /target/root/.ssh; \ - cp /authorized_keys /target/root/.ssh/ diff --git a/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 deleted file mode 100644 index a2fffd11..00000000 --- a/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ /dev/null @@ -1,160 +0,0 @@ -######################################################################### -# spreadspace preseed file for Ubuntu bionic based VMs -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string en_US.UTF-8 -d-i localechooser/preferred-locale string en_US.UTF-8 -d-i localechooser/supported-locales multiselect de_DE.UTF-8, de_AT.UTF-8 -d-i console-setup/ask_detect boolean false -d-i keyboard-configuration/xkb-keymap select us -d-i keyboard-configuration/layoutcode string us - -d-i hw-detect/load_firmware boolean false - -{% if preseed_no_netplan %} -d-i netcfg/do_not_use_netplan boolean true -{% endif %} -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} -d-i netcfg/disable_dhcp boolean false -d-i netcfg/disable_autoconfig boolean false -{% else %} -d-i netcfg/disable_dhcp boolean true -d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} -d-i netcfg/confirm_static boolean true -{% endif %} - -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} -d-i mirror/http/directory string /ubuntu -d-i mirror/http/proxy string - - -d-i passwd/make-user boolean false -d-i passwd/root-login boolean true -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - - -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true - -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} - -tasksel tasksel/first multiselect -d-i pkgsel/include string openssh-server python python-apt ifupdown -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false -d-i pkgsel/update-policy select none - -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ - in-target bash -c "swapoff -a; sed -e '/^\/swapfile/d' -i /etc/fstab; rm -f /swapfile"; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ -{% if preseed_no_netplan %} - in-target bash -c "apt-get purge -y -q netplan.io && apt-get autoremove -y -q && rm -rf /etc/netplan"; \ -{% endif %} - in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ -{% if preseed_force_net_ifnames_policy is defined %} - mkdir -p /target/etc/systemd/network; \ - in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "update-initramfs -u"; \ -{% endif %} - in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ -{% endif %} - mkdir -p -m 0700 /target/root/.ssh; \ - cp /authorized_keys /target/root/.ssh/ diff --git a/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 b/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 deleted file mode 100644 index 0b3d3698..00000000 --- a/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ /dev/null @@ -1,153 +0,0 @@ -######################################################################### -# spreadspace preseed file for Ubuntu xenial based VMs -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string en_US.UTF-8 -d-i localechooser/preferred-locale string en_US.UTF-8 -d-i localechooser/supported-locales multiselect de_DE.UTF-8, de_AT.UTF-8 -d-i console-setup/ask_detect boolean false -d-i keyboard-configuration/xkb-keymap select us -d-i keyboard-configuration/layoutcode string us - -d-i hw-detect/load_firmware boolean false - -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} -d-i netcfg/disable_dhcp boolean false -d-i netcfg/disable_autoconfig boolean false -{% else %} -d-i netcfg/disable_dhcp boolean true -d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} -d-i netcfg/confirm_static boolean true -{% endif %} - -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} -d-i mirror/http/directory string /ubuntu -d-i mirror/http/proxy string - - -d-i passwd/make-user boolean false -d-i passwd/root-login boolean true -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - - -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true - -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} - -tasksel tasksel/first multiselect -d-i pkgsel/include string openssh-server python python-apt -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false -d-i pkgsel/update-policy select none - -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ - in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ -{% if preseed_force_net_ifnames_policy is defined %} - mkdir -p /target/etc/systemd/network; \ - in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "update-initramfs -u"; \ -{% endif %} - in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ -{% endif %} - mkdir -p -m 0700 /target/root/.ssh; \ - cp /authorized_keys /target/root/.ssh/ diff --git a/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 b/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 deleted file mode 100644 index 22f47ce7..00000000 --- a/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 +++ /dev/null @@ -1,166 +0,0 @@ -######################################################################### -# spreadspace preseed file for Ubuntu cosmic based Workstations -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string de_AT.UTF-8 -d-i localechooser/preferred-locale string de_AT.UTF-8 -d-i localechooser/supported-locales multiselect de_DE.UTF-8, en_US.UTF-8 -d-i keyboard-configuration/xkb-keymap select de -## TODO: this still doesn't work properly... -d-i keyboard-configuration/layout select German (Austria) -d-i keyboard-configuration/layoutcode string at -d-i keyboard-configuration/layoutcode string nodeadkeys -d-i console-setup/ask_detect boolean false - -d-i hw-detect/load_firmware boolean false - -{% if preseed_no_netplan %} -d-i netcfg/do_not_use_netplan boolean true -{% endif %} -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} -{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} -d-i netcfg/disable_dhcp boolean false -d-i netcfg/disable_autoconfig boolean false -{% else %} -d-i netcfg/disable_dhcp boolean true -d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} -d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} -d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} -d-i netcfg/confirm_static boolean true -{% endif %} - -d-i netcfg/hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} -d-i netcfg/domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }} -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} -d-i mirror/http/directory string /ubuntu -d-i mirror/http/proxy string - - -d-i passwd/make-user boolean false -d-i passwd/root-login boolean true -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - -d-i partman-auto/disk string /dev/sda /dev/sdb - -d-i partman-auto/method string raid -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true -d-i partman-md/confirm boolean true -d-i partman-md/confirm_nooverwrite boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -d-i partman/choose_label string dos -d-i partman/default_label string dos -d-i partman-auto/choose_recipe select boot-root -d-i partman-auto/expert_recipe string \ - boot-root :: \ - 256 512 256 raid \ - $lvmignore{ } $primary{ } method{ raid } \ - . \ - 1000 10000 -1 raid \ - $lvmignore{ } $primary{ } method{ raid } \ - . \ - 15360 10000 20480 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 768 10000 768 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 20480 10000 20480 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /home } \ - . \ - 16 20000 -1 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-raid/recipe string \ - 1 2 0 ext4 /boot \ - /dev/sda1#/dev/sdb1 \ - . \ - 1 2 0 lvm - \ - /dev/sda2#/dev/sdb2 \ - . - -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[(hostvars[hostname].apt_repo_provider | default('default'))].ubuntu }} - -tasksel tasksel/first multiselect xubuntu-desktop -d-i pkgsel/include string openssh-server python python-apt ifupdown -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false -d-i pkgsel/update-policy select none - -d-i grub-installer/choose_bootdev string /dev/sda /dev/sdb -d-i grub-installer/bootdev string /dev/sda /dev/sdb -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i nobootloader/confirmation_common boolean true - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f {{ hostvars[hostname].host_name }}/dummy; \ - in-target bash -c "swapoff -a; sed -e '/^\/swapfile/d' -i /etc/fstab; rm -f /swapfile"; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ -{% if preseed_no_netplan %} - in-target bash -c "apt-get purge -y -q netplan.io && apt-get autoremove -y -q && rm -rf /etc/netplan"; \ -{% endif %} - in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ -{% if preseed_force_net_ifnames_policy is defined %} - mkdir -p /target/etc/systemd/network; \ - in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "update-initramfs -u"; \ -{% endif %} - in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ -{% endif %} - mkdir -p -m 0700 /target/root/.ssh; \ - cp /authorized_keys /target/root/.ssh/ diff --git a/roles/usb-install/meta/main.yml b/roles/usb-install/meta/main.yml index 0fc96588..9db4a441 100644 --- a/roles/usb-install/meta/main.yml +++ b/roles/usb-install/meta/main.yml @@ -1,5 +1,5 @@ dependencies: - - role: installer/debian + - role: installer/debian/base distros: - distro: "{{ install_distro }}" codename: "{{ install_codename }}" diff --git a/roles/usb-install/tasks/main.yml b/roles/usb-install/tasks/main.yml index fab32b02..3153b633 100644 --- a/roles/usb-install/tasks/main.yml +++ b/roles/usb-install/tasks/main.yml @@ -6,7 +6,7 @@ register: tmpdir - import_role: - name: preseed + name: installer/debian/preseed vars: preseed_tmpdir: "{{ tmpdir.path }}" diff --git a/roles/vm/install/meta/main.yml b/roles/vm/install/meta/main.yml index 347e30c4..34c068b6 100644 --- a/roles/vm/install/meta/main.yml +++ b/roles/vm/install/meta/main.yml @@ -1,6 +1,6 @@ --- # dependencies: -# - role: installer/debian +# - role: installer/debian/base # distros: # - distro: "{{ install_distro }}" # codename: "{{ install_codename }}" diff --git a/roles/vm/install/tasks/main.yml b/roles/vm/install/tasks/main.yml index 10b10e18..9d5ea6a2 100644 --- a/roles/vm/install/tasks/main.yml +++ b/roles/vm/install/tasks/main.yml @@ -29,7 +29,7 @@ register: tmpdir # - import_role: - # name: preseed + # name: installer/debian/preseed # vars: # ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" # preseed_tmpdir: "{{ tmpdir.path }}" -- cgit v1.2.3 From 2a89948bf13307cc936756c3a43bed51b3b49dc2 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 25 Dec 2019 18:20:54 +0100 Subject: openbsd vm install almost works now --- inventory/group_vars/kvmhosts/main.yml | 1 - inventory/host_vars/ch-router-obsd.yml | 11 ++++-- roles/installer/debian/preseed/defaults/main.yml | 3 +- .../openbsd/autoinstall/defaults/main.yml | 8 +++++ roles/installer/openbsd/autoinstall/tasks/main.yml | 41 ++++++++++++++++++++++ .../autoinstall/templates/auto_install.conf.j2 | 30 ++++++++++++++++ .../openbsd/autoinstall/templates/boot.conf.j2 | 5 +++ roles/installer/openbsd/base/tasks/main.yml | 28 +++------------ roles/vm/define/templates/libvirt-domain.xml.j2 | 6 +--- roles/vm/host/tasks/main.yml | 7 ++-- roles/vm/install/tasks/main.yml | 22 ++++++++---- 11 files changed, 118 insertions(+), 44 deletions(-) create mode 100644 roles/installer/openbsd/autoinstall/defaults/main.yml create mode 100644 roles/installer/openbsd/autoinstall/tasks/main.yml create mode 100644 roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 create mode 100644 roles/installer/openbsd/autoinstall/templates/boot.conf.j2 diff --git a/inventory/group_vars/kvmhosts/main.yml b/inventory/group_vars/kvmhosts/main.yml index eef2a639..917b41eb 100644 --- a/inventory/group_vars/kvmhosts/main.yml +++ b/inventory/group_vars/kvmhosts/main.yml @@ -1,3 +1,2 @@ --- -preseed_path: /srv/preseed installer_path: /srv/installer diff --git a/inventory/host_vars/ch-router-obsd.yml b/inventory/host_vars/ch-router-obsd.yml index 48788004..a88110f3 100644 --- a/inventory/host_vars/ch-router-obsd.yml +++ b/inventory/host_vars/ch-router-obsd.yml @@ -15,7 +15,14 @@ install: size: 10g interfaces: - bridge: br-svc - name: vi0 + name: vio0 autostart: True -network: {} +network: + nameservers: "{{ network_zones.svc.dns }}" + domain: "{{ host_domain }}" + primary: + interface: vio0 + ip: "{{ network_zones.svc.prefix | ipaddr(network_zones.svc.offsets[inventory_hostname]) | ipaddr('address') }}" + mask: "{{ network_zones.svc.prefix | ipaddr('netmask') }}" + gateway: "{{ network_zones.svc.gateway }}" diff --git a/roles/installer/debian/preseed/defaults/main.yml b/roles/installer/debian/preseed/defaults/main.yml index c5400493..18cfd952 100644 --- a/roles/installer/debian/preseed/defaults/main.yml +++ b/roles/installer/debian/preseed/defaults/main.yml @@ -1,4 +1,5 @@ --- -#preseed_force_net_ifnames_policy: path +#preseed_tmpdir: +#preseed_force_net_ifnames_policy: path preseed_no_netplan: no diff --git a/roles/installer/openbsd/autoinstall/defaults/main.yml b/roles/installer/openbsd/autoinstall/defaults/main.yml new file mode 100644 index 00000000..e3579ad0 --- /dev/null +++ b/roles/installer/openbsd/autoinstall/defaults/main.yml @@ -0,0 +1,8 @@ +--- +# obsd_autoinstall_tmpdir: + +# obsd_autoinstall_serial_device: com0 +# obsd_autoinstall_serial_baudrate: 115200 + +obsd_autoinstall_http_server: ftp2.eu.openbsd.org +obsd_autoinstall_file_sets: -comp* -game* -x* diff --git a/roles/installer/openbsd/autoinstall/tasks/main.yml b/roles/installer/openbsd/autoinstall/tasks/main.yml new file mode 100644 index 00000000..333b437f --- /dev/null +++ b/roles/installer/openbsd/autoinstall/tasks/main.yml @@ -0,0 +1,41 @@ +--- +- name: create basic cd-image directory structure + file: + path: "{{ obsd_autoinstall_tmpdir }}/files/etc" + state: directory + +- name: extract installer files from iso + vars: + arch: "{{ hostvars[hostname].install_cooked.arch | default('amd64') }}" + version: "{{ install_codename }}" + iso_extract: + image: "{{ installer_path }}/openbsd-{{ version }}/{{ arch }}/cd.iso" + dest: "{{ obsd_autoinstall_tmpdir }}/files" + files: + - "{{ version }}/{{ arch }}/cdbr" + - "{{ version }}/{{ arch }}/cdboot" + - "{{ version }}/{{ arch }}/bsd.rd" + +- name: generate bootloader and installer configuration + loop: + - auto_install.conf + - boot.conf + template: + src: "{{ item }}.j2" + dest: "{{ obsd_autoinstall_tmpdir }}/files/etc/{{ item }}" + +- name: generate random seed + shell: "head -c512 < /dev/random > {{ obsd_autoinstall_tmpdir }}/files/etc/random.seed" + +- name: generate host specific installer image + command: 'genisoimage -RTLldDN -o "cd.iso" -no-emul-boot -b "cdbr" -c "boot.catalog" files/' + args: + chdir: "{{ obsd_autoinstall_tmpdir }}/" + +# - print instructions +# * attach to console +# * select (S)hell +# * # mount_cd9660 /dev/cd0c /mnt +# * # cp /mnt/etc/auto_install.conf / +# * # autoinstall +# 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..6719aae3 --- /dev/null +++ b/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 @@ -0,0 +1,30 @@ +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 %} + +{# TODO: what if there are more than one ssh keys? #} +Public ssh key for root account = {{ ssh_keys_root[0] }} +Password for root = ! +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 = http +HTTP Server = {{ obsd_autoinstall_http_server }} +Set name(s) = {{ obsd_autoinstall_file_sets }} 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/base/tasks/main.yml b/roles/installer/openbsd/base/tasks/main.yml index fcc79589..04a4f4ce 100644 --- a/roles/installer/openbsd/base/tasks/main.yml +++ b/roles/installer/openbsd/base/tasks/main.yml @@ -12,31 +12,13 @@ label: "openbsd-{{ item.0.version }} {{ item.1 }}" get_url: url: "{{ openbsd_installer_url }}/{{ item.0.version }}/{{ item.1 }}/cd{{ item.0.version | replace('.', '') }}.iso" - dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd-orig.iso" + dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd.iso" mode: 0644 force: "{{ openbsd_installer_force_download }}" -- name: install geniosimage +# TODO: verify the image using openbsd-signify + +- name: install genisoimage apt: - name: geniosimage + name: genisoimage state: present - -## TODO -# - iso_extract from cd-orig.iso -> <>/<>/{boot.catalog,cdbr,cdboot,bsd.rd}, etc/boot.conf -# - add lines to etc/boot.conf -> stty com0 115200, set tty com0 -# - generate etc/auto_install.conf -# - name: generate host specific installer image -# loop: "{{ openbsd_versions | subelements('arch') }}" -# loop_control: -# label: "openbsd-{{ item.0.version }} {{ item.1 }}" -# command: 'genisoimage -RTLldDN -o "cd-{{ ansible_nodename }}.iso" -no-emul-boot -b "{{ item.0.version }}/{{ item.1 }}/cdbr" -c "{{ item.0.version }}/{{ item.1 }}/boot.catalog" data-{{ ansible_nodename }}/' -# args: -# chdir: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}" -# -# - print instructions -# * attach to console -# * select (S)hell -# * # mount_cd9660 /dev/cd0c /mnt -# * # cp /mnt/etc/auto_install.conf / -# * # autoinstall -# diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index 809a4a1e..1abd43ed 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -44,15 +44,11 @@ {% if vm_define_installer and install_distro == 'openbsd' %} - + - - - - {% endif %} {% if 'virtio' in hostvars[hostname].install_cooked.disks %} {% for device, src in hostvars[hostname].install_cooked.disks.virtio.items() %} diff --git a/roles/vm/host/tasks/main.yml b/roles/vm/host/tasks/main.yml index ef349d4c..0e11da3d 100644 --- a/roles/vm/host/tasks/main.yml +++ b/roles/vm/host/tasks/main.yml @@ -43,10 +43,7 @@ fstype: "{{ installer_lvm.fs }}" state: mounted -- name: make sure installer directories exists - loop: - - "{{ installer_path }}" - - "{{ preseed_path }}" +- name: make sure installer directory exists file: - name: "{{ item }}" + name: "{{ installer_path }}" state: directory diff --git a/roles/vm/install/tasks/main.yml b/roles/vm/install/tasks/main.yml index 9d5ea6a2..ab94d4e5 100644 --- a/roles/vm/install/tasks/main.yml +++ b/roles/vm/install/tasks/main.yml @@ -37,13 +37,21 @@ # preseed_no_netplan: yes # install_interface: enp1s1 - # - name: Make preseed workdir readable by qemu - # acl: - # path: "{{ tmpdir.path }}" - # state: present - # entity: libvirt-qemu - # etype: user - # permissions: rx + - import_role: + name: installer/openbsd/autoinstall + vars: + ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" + obsd_autoinstall_tmpdir: "{{ tmpdir.path }}" + obsd_autoinstall_serial_device: com0 + install_interface: vio0 + + - name: Make installer workdir readable by qemu + acl: + path: "{{ tmpdir.path }}" + state: present + entity: libvirt-qemu + etype: user + permissions: rx - import_role: name: vm/define -- cgit v1.2.3 From b0920686096aadd8e0bb5772956f4e1d443fe72b Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 25 Dec 2019 22:34:10 +0100 Subject: openbsd installer: generate iso with filesets --- .../openbsd/autoinstall/defaults/main.yml | 15 ++++++++-- roles/installer/openbsd/autoinstall/tasks/main.yml | 34 ++++++++++++++-------- .../autoinstall/templates/auto_install.conf.j2 | 8 +++-- roles/installer/openbsd/base/tasks/main.yml | 4 +-- roles/vm/define/templates/libvirt-domain.xml.j2 | 2 +- 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/roles/installer/openbsd/autoinstall/defaults/main.yml b/roles/installer/openbsd/autoinstall/defaults/main.yml index e3579ad0..cdea194e 100644 --- a/roles/installer/openbsd/autoinstall/defaults/main.yml +++ b/roles/installer/openbsd/autoinstall/defaults/main.yml @@ -1,8 +1,19 @@ --- # obsd_autoinstall_tmpdir: +obsd_autoinstall_arch: "{{ hostvars[hostname].install_cooked.arch | default('amd64') }}" +obsd_autoinstall_version: "{{ install_codename }}" +obsd_autoinstall_version_short: "{{ obsd_autoinstall_version | replace('.', '') }}" + # obsd_autoinstall_serial_device: com0 # obsd_autoinstall_serial_baudrate: 115200 -obsd_autoinstall_http_server: ftp2.eu.openbsd.org -obsd_autoinstall_file_sets: -comp* -game* -x* +obsd_autoinstall_file_sets: + - base + - man + #- comp + #- game + #- xbase + #- xfont + #- xserv + #- xshare diff --git a/roles/installer/openbsd/autoinstall/tasks/main.yml b/roles/installer/openbsd/autoinstall/tasks/main.yml index 333b437f..79aa8eda 100644 --- a/roles/installer/openbsd/autoinstall/tasks/main.yml +++ b/roles/installer/openbsd/autoinstall/tasks/main.yml @@ -1,20 +1,20 @@ --- - name: create basic cd-image directory structure + loop: + - etc + - sets file: - path: "{{ obsd_autoinstall_tmpdir }}/files/etc" + path: "{{ obsd_autoinstall_tmpdir }}/files/{{ item }}" state: directory - name: extract installer files from iso - vars: - arch: "{{ hostvars[hostname].install_cooked.arch | default('amd64') }}" - version: "{{ install_codename }}" iso_extract: - image: "{{ installer_path }}/openbsd-{{ version }}/{{ arch }}/cd.iso" + image: "{{ installer_path }}/openbsd-{{ obsd_autoinstall_version }}/{{ obsd_autoinstall_arch }}/install.iso" dest: "{{ obsd_autoinstall_tmpdir }}/files" files: - - "{{ version }}/{{ arch }}/cdbr" - - "{{ version }}/{{ arch }}/cdboot" - - "{{ version }}/{{ arch }}/bsd.rd" + - "{{ obsd_autoinstall_version }}/{{ obsd_autoinstall_arch }}/cdbr" + - "{{ obsd_autoinstall_version }}/{{ obsd_autoinstall_arch }}/cdboot" + - "{{ obsd_autoinstall_version }}/{{ obsd_autoinstall_arch }}/bsd.rd" - name: generate bootloader and installer configuration loop: @@ -27,15 +27,25 @@ - name: generate random seed shell: "head -c512 < /dev/random > {{ obsd_autoinstall_tmpdir }}/files/etc/random.seed" +- name: extract file-sets from iso + vars: + set_names: + - bsd + - bsd.rd + - "INSTALL.{{ obsd_autoinstall_arch }}" + - "{{ obsd_autoinstall_file_sets | product([obsd_autoinstall_version_short+'.tgz']) | map('join') | list }}" + iso_extract: + image: "{{ installer_path }}/openbsd-{{ obsd_autoinstall_version }}/{{ obsd_autoinstall_arch }}/install.iso" + dest: "{{ obsd_autoinstall_tmpdir }}/files/sets" + files: "{{ [obsd_autoinstall_version+'/'+obsd_autoinstall_arch+'/'] | product(set_names | flatten) | map('join') | list }}" + - name: generate host specific installer image - command: 'genisoimage -RTLldDN -o "cd.iso" -no-emul-boot -b "cdbr" -c "boot.catalog" files/' + command: 'genisoimage -RTLldDN -o "install.iso" -no-emul-boot -b "cdbr" -c "boot.catalog" files/' args: chdir: "{{ obsd_autoinstall_tmpdir }}/" # - print instructions # * attach to console # * select (S)hell -# * # mount_cd9660 /dev/cd0c /mnt -# * # cp /mnt/etc/auto_install.conf / -# * # autoinstall +# * # mount_cd9660 /dev/cd0c /mnt && cp /mnt/etc/auto_install.conf / && autoinstall # diff --git a/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 b/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 index 6719aae3..46a87cc8 100644 --- a/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 +++ b/roles/installer/openbsd/autoinstall/templates/auto_install.conf.j2 @@ -25,6 +25,8 @@ Allow root ssh login = prohibit-password What timezone are you in = Europe/Vienna -Location of sets = http -HTTP Server = {{ obsd_autoinstall_http_server }} -Set name(s) = {{ obsd_autoinstall_file_sets }} +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/base/tasks/main.yml b/roles/installer/openbsd/base/tasks/main.yml index 04a4f4ce..0d5053d5 100644 --- a/roles/installer/openbsd/base/tasks/main.yml +++ b/roles/installer/openbsd/base/tasks/main.yml @@ -11,8 +11,8 @@ loop_control: label: "openbsd-{{ item.0.version }} {{ item.1 }}" get_url: - url: "{{ openbsd_installer_url }}/{{ item.0.version }}/{{ item.1 }}/cd{{ item.0.version | replace('.', '') }}.iso" - dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/cd.iso" + url: "{{ openbsd_installer_url }}/{{ item.0.version }}/{{ item.1 }}/install{{ item.0.version | replace('.', '') }}.iso" + dest: "{{ installer_path }}/openbsd-{{ item.0.version }}/{{ item.1 }}/install.iso" mode: 0644 force: "{{ openbsd_installer_force_download }}" diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index 1abd43ed..2a2e4388 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -44,7 +44,7 @@ {% if vm_define_installer and install_distro == 'openbsd' %} - + -- cgit v1.2.3 From 7b2223d9eeefa92ea968836d6c65c4d96461cdf7 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 26 Dec 2019 03:35:16 +0100 Subject: openbsd: add site.tgz to further customize the installation --- inventory/hosts.ini | 2 +- roles/installer/openbsd/autoinstall/tasks/main.yml | 20 ++++++++++++++++---- .../autoinstall/templates/auto_install.conf.j2 | 4 ++-- .../openbsd/autoinstall/templates/install.site.j2 | 21 +++++++++++++++++++++ 4 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 roles/installer/openbsd/autoinstall/templates/install.site.j2 diff --git a/inventory/hosts.ini b/inventory/hosts.ini index b45fb494..4847c64a 100644 --- a/inventory/hosts.ini +++ b/inventory/hosts.ini @@ -21,7 +21,7 @@ ch-testvm host_name=testvm ch-mimas2 host_name=mimas ch-gnocchi host_name=gnocchi ch-router host_name=router -ch-router-obsd host_name=router ansible_port=22 +ch-router-obsd host_name=router ch-gw-lan host_name=gw-lan ch-jump host_name=jump ansible_port=2342 ansible_host=ch-jump 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 < /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 -- cgit v1.2.3 From 0b25de101de1cc1a43ae47edfd89d43ae28a642d Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 26 Dec 2019 14:41:44 +0100 Subject: openbsd installer runs thtrough now --- inventory/group_vars/openbsd/main.yml | 2 ++ inventory/hosts.ini | 4 ++++ roles/installer/openbsd/autoinstall/tasks/main.yml | 10 +++++----- roles/vm/install/tasks/main.yml | 9 +++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 inventory/group_vars/openbsd/main.yml diff --git a/inventory/group_vars/openbsd/main.yml b/inventory/group_vars/openbsd/main.yml new file mode 100644 index 00000000..913008d0 --- /dev/null +++ b/inventory/group_vars/openbsd/main.yml @@ -0,0 +1,2 @@ +--- +ansible_python_interpreter: /usr/local/bin/python3.7 diff --git a/inventory/hosts.ini b/inventory/hosts.ini index 4847c64a..3892abbe 100644 --- a/inventory/hosts.ini +++ b/inventory/hosts.ini @@ -180,6 +180,10 @@ r3-cccamp19-sw0 chaos-at-home-switches +[openbsd] +ch-router-obsd + + [kvmhosts] ch-atlas ch-gnocchi diff --git a/roles/installer/openbsd/autoinstall/tasks/main.yml b/roles/installer/openbsd/autoinstall/tasks/main.yml index a4e63f3f..cb9975de 100644 --- a/roles/installer/openbsd/autoinstall/tasks/main.yml +++ b/roles/installer/openbsd/autoinstall/tasks/main.yml @@ -56,8 +56,8 @@ args: chdir: "{{ obsd_autoinstall_tmpdir }}/" -# - print instructions -# * attach to console -# * select (S)hell -# * # mount_cd9660 /dev/cd0c /mnt && cp /mnt/etc/auto_install.conf / && autoinstall -# +- name: set additional installer info + set_fact: + installer_manual_steps_msg: | + * at the installer prompt select: (S)hell + * # mount_cd9660 /dev/cd0c /mnt && cp /mnt/etc/auto_install.conf / && autoinstall diff --git a/roles/vm/install/tasks/main.yml b/roles/vm/install/tasks/main.yml index ab94d4e5..bc31967a 100644 --- a/roles/vm/install/tasks/main.yml +++ b/roles/vm/install/tasks/main.yml @@ -62,6 +62,15 @@ - debug: msg: "you can check on the status of the installer running this command 'virsh console {{ hostname }}' on host {{ inventory_hostname }}." + - when: installer_manual_steps_msg is defined + pause: + prompt: | + Mind that this installer needs manual steps to be performed: + + {{ installer_manual_steps_msg | indent(2) }} + + When done press enter to continue or Ctrl-C + 'A' to abort. + - name: wait for installer to finish or crash wait_for_virt: name: "{{ hostname }}" -- cgit v1.2.3 From 85f91135e58106b838083bd8a96734be6abafad1 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 26 Dec 2019 18:38:37 +0100 Subject: make vm install work for both debian/ubuntu and openbsd --- common/vm-install.yml | 21 ++++++++++++--------- roles/vm/install/meta/main.yml | 7 ------- roles/vm/install/tasks/main.yml | 22 ++++++++++++---------- 3 files changed, 24 insertions(+), 26 deletions(-) delete mode 100644 roles/vm/install/meta/main.yml diff --git a/common/vm-install.yml b/common/vm-install.yml index 02c95fd8..cb3b86f0 100644 --- a/common/vm-install.yml +++ b/common/vm-install.yml @@ -45,15 +45,18 @@ set_fact: ansible_ssh_extra_args: "" -# - name: apply basic VM configuration roles -# hosts: "{{ hostname }}" -# pre_tasks: -# - name: make sure to update cached facts -# setup: -# roles: -# - role: vm/grub -# - role: vm/network -# - role: vm/guest +- name: apply basic VM configuration roles + hosts: "{{ hostname }}" + pre_tasks: + - name: make sure to update cached facts + setup: + roles: + - role: vm/grub + when: install_distro in ['debian', 'ubuntu'] + - role: vm/network + when: install_distro in ['debian', 'ubuntu'] + - role: vm/guest + when: install_distro in ['debian', 'ubuntu'] - import_playbook: "../{{ hostenv }}/{{ hostname }}.yml" diff --git a/roles/vm/install/meta/main.yml b/roles/vm/install/meta/main.yml deleted file mode 100644 index 34c068b6..00000000 --- a/roles/vm/install/meta/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# dependencies: -# - role: installer/debian/base -# distros: -# - distro: "{{ install_distro }}" -# codename: "{{ install_codename }}" -# arch: [ "{{ hostvars[hostname].install_cooked.arch | default('amd64') }}" ] diff --git a/roles/vm/install/tasks/main.yml b/roles/vm/install/tasks/main.yml index bc31967a..20484401 100644 --- a/roles/vm/install/tasks/main.yml +++ b/roles/vm/install/tasks/main.yml @@ -28,22 +28,24 @@ state: directory register: tmpdir - # - import_role: - # name: installer/debian/preseed - # vars: - # ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" - # preseed_tmpdir: "{{ tmpdir.path }}" - # preseed_force_net_ifnames_policy: path - # preseed_no_netplan: yes - # install_interface: enp1s1 + - when: install_distro in ['debian', 'ubuntu'] + vars: + ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" + preseed_tmpdir: "{{ tmpdir.path }}" + preseed_force_net_ifnames_policy: path + preseed_no_netplan: yes + install_interface: enp1s1 + import_role: + name: installer/debian/preseed - - import_role: - name: installer/openbsd/autoinstall + - when: install_distro in ['openbsd'] vars: ssh_keys_root: "{{ hostvars[hostname].ssh_keys_root }}" obsd_autoinstall_tmpdir: "{{ tmpdir.path }}" obsd_autoinstall_serial_device: com0 install_interface: vio0 + import_role: + name: installer/openbsd/autoinstall - name: Make installer workdir readable by qemu acl: -- cgit v1.2.3 From c7006b00fb5664423daeee3b83aa347cf959701b Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 26 Dec 2019 21:50:16 +0100 Subject: zsh and sshd role support debian and openbsd now --- .../openbsd/autoinstall/templates/install.site.j2 | 5 ++-- roles/sshd/handlers/main.yml | 2 +- roles/sshd/tasks/main.yml | 11 ++++++- roles/sshd/vars/Debian.yml | 3 ++ roles/sshd/vars/OpenBSD.yml | 2 ++ roles/zsh/tasks/main.yml | 35 ++++++++++++---------- roles/zsh/templates/banner.chaos-at-home.j2 | 2 +- roles/zsh/templates/banner.elevate.j2 | 2 +- roles/zsh/templates/banner.skillz.j2 | 2 +- roles/zsh/templates/banner.spreadspace.j2 | 2 +- roles/zsh/vars/Debian.yml | 12 ++++++++ roles/zsh/vars/OpenBSD.yml | 12 ++++++++ 12 files changed, 66 insertions(+), 24 deletions(-) create mode 100644 roles/sshd/vars/Debian.yml create mode 100644 roles/sshd/vars/OpenBSD.yml create mode 100644 roles/zsh/vars/Debian.yml create mode 100644 roles/zsh/vars/OpenBSD.yml diff --git a/roles/installer/openbsd/autoinstall/templates/install.site.j2 b/roles/installer/openbsd/autoinstall/templates/install.site.j2 index f4f9524d..d12ed461 100644 --- a/roles/installer/openbsd/autoinstall/templates/install.site.j2 +++ b/roles/installer/openbsd/autoinstall/templates/install.site.j2 @@ -1,8 +1,7 @@ #!/bin/sh -## TODO: enable this once we know how this works -## echo "Generating random root pasword" -## openssl rand -base64 24 | passwd root +echo "Generating random root pasword" +usermod -p "$(openssl rand -base64 24 | encrypt)" root echo "Installing SSH keys for root" cat < /root/.ssh/authorized_keys diff --git a/roles/sshd/handlers/main.yml b/roles/sshd/handlers/main.yml index f43817f2..ea76595a 100644 --- a/roles/sshd/handlers/main.yml +++ b/roles/sshd/handlers/main.yml @@ -1,5 +1,5 @@ --- - name: restart ssh service: - name: sshd + name: "{{ sshd_service_name }}" state: restarted diff --git a/roles/sshd/tasks/main.yml b/roles/sshd/tasks/main.yml index f98ea536..d73d778b 100644 --- a/roles/sshd/tasks/main.yml +++ b/roles/sshd/tasks/main.yml @@ -1,4 +1,12 @@ --- +- name: load os/distrubtion/version specific variables + include_vars: "{{ item }}" + with_first_found: + - files: + - "{{ ansible_distribution_release }}.yml" + - "{{ ansible_distribution }}.yml" + - "{{ ansible_os_family }}.yml" + - name: hardening ssh-server config vars: sshd_options: @@ -32,6 +40,7 @@ exclusive: yes - name: delete root password + when: sshd_disabled_password is defined user: name: root - password: "!" + password: "{{ sshd_disabled_password }}" diff --git a/roles/sshd/vars/Debian.yml b/roles/sshd/vars/Debian.yml new file mode 100644 index 00000000..abbccabc --- /dev/null +++ b/roles/sshd/vars/Debian.yml @@ -0,0 +1,3 @@ +--- +sshd_service_name: ssh +sshd_disabled_password: '!' diff --git a/roles/sshd/vars/OpenBSD.yml b/roles/sshd/vars/OpenBSD.yml new file mode 100644 index 00000000..abdaf180 --- /dev/null +++ b/roles/sshd/vars/OpenBSD.yml @@ -0,0 +1,2 @@ +--- +sshd_service_name: sshd diff --git a/roles/zsh/tasks/main.yml b/roles/zsh/tasks/main.yml index f0aa696e..a5ae60ec 100644 --- a/roles/zsh/tasks/main.yml +++ b/roles/zsh/tasks/main.yml @@ -1,13 +1,21 @@ --- -- name: install zsh packages - openbsd_pkg: +- name: load os/distrubtion/version specific variables + include_vars: "{{ item }}" + with_first_found: + - files: + - "{{ ansible_distribution_release }}.yml" + - "{{ ansible_distribution }}.yml" + - "{{ ansible_os_family }}.yml" + +- name: install zsh package + package: name: zsh state: present - name: install zsh-config loop: - src: "zshrc" - dest: "/etc/zshrc" + dest: "{{ zsh_conf_base_dir }}/zshrc" - src: "zshrc.skel" dest: "/etc/skel/.zshrc" loop_control: @@ -20,19 +28,16 @@ loop: "{{ [ 'root' ] | union(zsh_loginshell_user | default([])) }}" user: name: "{{ item }}" - shell: /usr/local/bin/zsh - -- name: make zsh the default shell for useradd - lineinfile: - regexp: '^#?shell\s' - line: 'shell /usr/local/bin/zsh' - path: /etc/usermgmt.conf + shell: "{{ zsh_bin_path }}" -- name: make zsh the default shell for adduser +- name: make zsh the default shell for new users + loop: "{{ zsh_default_shell_lineinfile | dict2items }}" + loop_control: + label: "{{ item.key }} ('{{ item.value.regexp }}' -> '{{ item.value.line }}')" lineinfile: - regexp: '^#?defaultshell=' - line: 'defaultshell=/usr/local/bin/zsh' - path: /etc/adduser.conf + path: "{{ item.key }}" + regexp: "{{ item.value.regexp }}" + line: "{{ item.value.line }}" create: yes - name: install shell banner @@ -47,7 +52,7 @@ - name: enable banner for zsh login lineinfile: - path: /etc/zlogin + path: "{{ zsh_conf_base_dir }}/zlogin" line: /etc/banner.sh insertbefore: "^## END OF FILE #" create: yes diff --git a/roles/zsh/templates/banner.chaos-at-home.j2 b/roles/zsh/templates/banner.chaos-at-home.j2 index e9b6baa9..c0e71647 100644 --- a/roles/zsh/templates/banner.chaos-at-home.j2 +++ b/roles/zsh/templates/banner.chaos-at-home.j2 @@ -1,4 +1,4 @@ -#!/bin/ksh +#!{{ zsh_banner_shell }} echo -e "" echo -e " \033[0;37m █████╗██╗ ██╗ ████╗ █████╗ ██████╗\033[1;30m ██████╗ \033[0;37m██╗ ██╗ █████╗ ███╗ ███╗█████╗\033[0m" diff --git a/roles/zsh/templates/banner.elevate.j2 b/roles/zsh/templates/banner.elevate.j2 index cca0850d..03dfa73b 100644 --- a/roles/zsh/templates/banner.elevate.j2 +++ b/roles/zsh/templates/banner.elevate.j2 @@ -1,4 +1,4 @@ -#!/bin/ksh +#!{{ zsh_banner_shell }} echo -e "" echo -e " \033[1;37m██████████ ██ ██████████ ▜█▙ ▟█▛ ▟██▙ ██████████ ██████████\033[0m" diff --git a/roles/zsh/templates/banner.skillz.j2 b/roles/zsh/templates/banner.skillz.j2 index f750f9e6..4c883d22 100644 --- a/roles/zsh/templates/banner.skillz.j2 +++ b/roles/zsh/templates/banner.skillz.j2 @@ -1,4 +1,4 @@ -#!/bin/ksh +#!{{ zsh_banner_shell }} echo -e "" echo -e " \033[1;35m███████╗██╗ ██╗██╗██╗ ██╗ ███████╗\033[0;35m ██████╗ ██╗███████╗\033[0m" diff --git a/roles/zsh/templates/banner.spreadspace.j2 b/roles/zsh/templates/banner.spreadspace.j2 index 580aa4c8..c592804e 100644 --- a/roles/zsh/templates/banner.spreadspace.j2 +++ b/roles/zsh/templates/banner.spreadspace.j2 @@ -1,4 +1,4 @@ -#!/bin/ksh +#!{{ zsh_banner_shell }} echo -e "" echo -e " \033[0;33m█████╗█████╗ █████╗ █████╗ ████╗ █████╗ █████╗█████╗ ████╗ ████╗█████╗\033[0m" diff --git a/roles/zsh/vars/Debian.yml b/roles/zsh/vars/Debian.yml new file mode 100644 index 00000000..7138fd2f --- /dev/null +++ b/roles/zsh/vars/Debian.yml @@ -0,0 +1,12 @@ +--- +zsh_banner_shell: /bin/bash +zsh_bin_path: /bin/zsh +zsh_conf_base_dir: /etc/zsh + +zsh_default_shell_lineinfile: + /etc/default/useradd: + regexp: '^#?SHELL=' + line: 'SHELL=/bin/zsh' + /etc/adduser.conf: + regexp: '^#?DSHELL=' + line: 'DSHELL=/bin/zsh' diff --git a/roles/zsh/vars/OpenBSD.yml b/roles/zsh/vars/OpenBSD.yml new file mode 100644 index 00000000..d11fe11e --- /dev/null +++ b/roles/zsh/vars/OpenBSD.yml @@ -0,0 +1,12 @@ +--- +zsh_banner_shell: /bin/ksh +zsh_bin_path: /usr/local/bin/zsh +zsh_conf_base_dir: /etc + +zsh_default_shell_lineinfile: + /etc/usermgmt.conf: + regexp: '^#?shell\s' + line: 'shell /usr/local/bin/zsh' + /etc/adduser.conf: + regexp: '^#?defaultshell=' + line: 'defaultshell=/usr/local/bin/zsh' -- cgit v1.2.3 From f5b24e7977b5e453bde40b52f1cf7bbc1bb67ae2 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 26 Dec 2019 23:24:40 +0100 Subject: base role supports openbsd now too --- chaos-at-home/ch-router-obsd.yml | 2 +- roles/base/tasks/Debian.yml | 124 +++++++++++++++++++ roles/base/tasks/OpenBSD.yml | 14 +++ roles/base/tasks/main.yml | 135 ++------------------- .../openbsd/autoinstall/templates/install.site.j2 | 6 + 5 files changed, 156 insertions(+), 125 deletions(-) create mode 100644 roles/base/tasks/Debian.yml create mode 100644 roles/base/tasks/OpenBSD.yml diff --git a/chaos-at-home/ch-router-obsd.yml b/chaos-at-home/ch-router-obsd.yml index fe3ef36f..76b79316 100644 --- a/chaos-at-home/ch-router-obsd.yml +++ b/chaos-at-home/ch-router-obsd.yml @@ -2,6 +2,6 @@ - name: Basic Setup hosts: ch-router-obsd roles: - #- role: base + - role: base - role: sshd - role: zsh diff --git a/roles/base/tasks/Debian.yml b/roles/base/tasks/Debian.yml new file mode 100644 index 00000000..25195ad2 --- /dev/null +++ b/roles/base/tasks/Debian.yml @@ -0,0 +1,124 @@ +--- +- name: load distrubtion specific variables + include_vars: "{{ item }}" + with_first_found: + - files: + - "{{ ansible_distribution_release }}.yml" + - "{{ ansible_distribution }}.yml" + skip: true + +- name: disable recommends and suggests + copy: + src: 02no-recommends + dest: /etc/apt/apt.conf.d/ + +- name: install base system tools + apt: + name: + - htop + - dstat + - lsof + - gawk + - psmisc + - less + - debian-goodies + - screen + - mtr-tiny + - tcpdump + - iptraf-ng + - unp + - dbus + - libpam-systemd + - aptitude + - ca-certificates + - file + - man-db + - manpages + - nano + state: present + +- name: install extra packages + apt: + name: "{{ base_packages_extra_host | union(base_packages_extra_group) }}" + state: present + +- name: install rngd + when: base_entropy_generator == 'rngd' + block: + - name: install rngd + apt: + name: "{{ base_rngd_package_name }}" + state: present + + - name: make sure haveged is removed/purged + apt: + name: haveged + state: absent + purge: yes + + +- name: install haveged + when: base_entropy_generator == 'haveged' + block: + - name: install haveged + apt: + name: haveged + state: present + + - name: make sure rngd is removed/purged + apt: + name: "{{ base_rngd_package_name }}" + state: absent + purge: yes + + +- name: Ensure /root is not world accessible + file: + path: /root + mode: 0700 + owner: root + group: root + state: directory + +- name: disable net/fs/misc kernel modules + loop: "{{ modules_blacklist.net | union(modules_blacklist.fs) | union(modules_blacklist.misc) }}" + lineinfile: + dest: /etc/modprobe.d/disablemod.conf + line: "install {{ item }} /bin/true" + create: yes + owner: root + group: root + mode: 0644 + +- name: Change various sysctl-settings, look at the sysctl-vars file for documentation + loop: "{{ sysctl_config | combine(sysctl_config_user) | dict2items }}" + loop_control: + label: "{{ item.key }} = {{ item.value }}" + sysctl: + name: "{{ item.key }}" + value: "{{ item.value }}" + sysctl_set: yes + state: present + reload: yes + ignoreerrors: yes + +- name: set kernel command line options + lineinfile: + path: /etc/default/grub + regexp: '^#?GRUB_CMDLINE_LINUX=' + line: 'GRUB_CMDLINE_LINUX="{{ install.kernel_cmdline | join(" ") }}"' + when: install is defined and install.kernel_cmdline is defined + notify: update grub + +- name: disable TSO (intel nic stability fix) + when: base_intel_nic_stability_fix + copy: + content: | + [Match] + MACAddress={{ ansible_default_ipv4.macaddress }} + + [Link] + TCPSegmentationOffload=false + GenericSegmentationOffload=false + GenericReceiveOffload=false + dest: /etc/systemd/network/00-disable-offloading.link diff --git a/roles/base/tasks/OpenBSD.yml b/roles/base/tasks/OpenBSD.yml new file mode 100644 index 00000000..4b64105c --- /dev/null +++ b/roles/base/tasks/OpenBSD.yml @@ -0,0 +1,14 @@ +--- +- name: install base system tools + openbsd_pkg: + name: + - htop + - screen-- + - mtr-- + - nano + state: present + +- name: install extra packages + openbsd_pkg: + name: "{{ base_packages_extra_host | union(base_packages_extra_group) }}" + state: present diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 3f1d9bee..5484a3a6 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -1,72 +1,15 @@ --- -- name: load distrubtion specific variables - include_vars: "{{ item }}" - with_first_found: - - files: - - "{{ ansible_distribution_release }}.yml" - - "{{ ansible_distribution }}.yml" - skip: true - -- name: disable recommends and suggests - copy: - src: 02no-recommends - dest: /etc/apt/apt.conf.d/ - -- name: install base system tools - apt: - name: - - htop - - dstat - - lsof - - gawk - - psmisc - - less - - debian-goodies - - screen - - mtr-tiny - - tcpdump - - iptraf-ng - - unp - - dbus - - libpam-systemd - - aptitude - - ca-certificates - - file - - man-db - - manpages - - nano - state: present - - -- name: install rngd - when: base_entropy_generator == 'rngd' - block: - - name: install rngd - apt: - name: "{{ base_rngd_package_name }}" - state: present - - - name: make sure haveged is removed/purged - apt: - name: haveged - state: absent - purge: yes - - -- name: install haveged - when: base_entropy_generator == 'haveged' - block: - - name: install haveged - apt: - name: haveged - state: present - - - name: make sure rngd is removed/purged - apt: - name: "{{ base_rngd_package_name }}" - state: absent - purge: yes - +- name: load os/distrubtion/version specific tasks + vars: + params: + files: + - "{{ ansible_distribution_release }}.yml" + - "{{ ansible_distribution }}.yml" + - "{{ ansible_os_family }}.yml" + loop: "{{ q('first_found', params) }}" + loop_control: + loop_var: tasks_file + include_tasks: "{{ tasks_file }}" - name: Remove startup message from screen lineinfile: @@ -93,59 +36,3 @@ copy: src: "{{ global_files_dir }}/common/htoprc" dest: "{{ item }}/.config/htop/" - -- name: Ensure /root is not world accessible - file: - path: /root - mode: 0700 - owner: root - group: root - state: directory - -- name: disable net/fs/misc kernel modules - loop: "{{ modules_blacklist.net | union(modules_blacklist.fs) | union(modules_blacklist.misc) }}" - lineinfile: - dest: /etc/modprobe.d/disablemod.conf - line: "install {{ item }} /bin/true" - create: yes - owner: root - group: root - mode: 0644 - -- name: Change various sysctl-settings, look at the sysctl-vars file for documentation - loop: "{{ sysctl_config | combine(sysctl_config_user) | dict2items }}" - loop_control: - label: "{{ item.key }} = {{ item.value }}" - sysctl: - name: "{{ item.key }}" - value: "{{ item.value }}" - sysctl_set: yes - state: present - reload: yes - ignoreerrors: yes - -- name: install extra packages - apt: - name: "{{ base_packages_extra_host | union(base_packages_extra_group) }}" - state: present - -- name: set kernel command line options - lineinfile: - path: /etc/default/grub - regexp: '^#?GRUB_CMDLINE_LINUX=' - line: 'GRUB_CMDLINE_LINUX="{{ install.kernel_cmdline | join(" ") }}"' - when: install is defined and install.kernel_cmdline is defined - notify: update grub - -- name: disable TSO (intel nic stability fix) - when: base_intel_nic_stability_fix - copy: - content: | - [Match] - MACAddress={{ ansible_default_ipv4.macaddress }} - - [Link] - TCPSegmentationOffload=false - GenericSegmentationOffload=false - GenericReceiveOffload=false - dest: /etc/systemd/network/00-disable-offloading.link diff --git a/roles/installer/openbsd/autoinstall/templates/install.site.j2 b/roles/installer/openbsd/autoinstall/templates/install.site.j2 index d12ed461..82928daa 100644 --- a/roles/installer/openbsd/autoinstall/templates/install.site.j2 +++ b/roles/installer/openbsd/autoinstall/templates/install.site.j2 @@ -16,5 +16,11 @@ sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /e echo "Installing python" pkg_add -Im python%3.7 +echo "Disable sndiod service on first boot" +cat <> /etc/rc.firsttime + +rcctl disable sndiod +rcctl stop sndiod +EOF rm /install.site -- cgit v1.2.3