From 8fceff60fe72696f820284a2323f89c0d62ab51d Mon Sep 17 00:00:00 2001 From: Michael Aldridge Date: Tue, 27 Sep 2016 21:55:57 -0500 Subject: [PATCH] Configure lugbox to deploy Void --- .gitignore | 3 +- .gitmodules | 3 + host_vars/lugbox.yml | 8 +- inventory | 6 +- roles/preseed-overlay | 1 + roles/void-deployment/files/autoinstall.cfg | 81 +++++++++++++++++++++ roles/void-deployment/meta/main.yml | 3 + roles/void-deployment/tasks/main.yml | 9 +++ void-deployment.yml | 8 ++ 9 files changed, 116 insertions(+), 6 deletions(-) create mode 160000 roles/preseed-overlay create mode 100644 roles/void-deployment/files/autoinstall.cfg create mode 100644 roles/void-deployment/meta/main.yml create mode 100644 roles/void-deployment/tasks/main.yml create mode 100644 void-deployment.yml diff --git a/.gitignore b/.gitignore index f6628a4..3493c46 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -secret/ \ No newline at end of file +secret/ +roles/void-deployment/files/netboot.tar.gz diff --git a/.gitmodules b/.gitmodules index 9f0f3fc..de73ed4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,3 +37,6 @@ [submodule "roles/greeter-theme/files/lug-greeter-theme"] path = roles/greeter-theme/files/lug-greeter-theme url = git@github.com:utdlug/lug-greeter-theme.git +[submodule "roles/preseed-overlay"] + path = roles/preseed-overlay + url = git@github.com:SimpleGateway/preseed-overlay.git diff --git a/host_vars/lugbox.yml b/host_vars/lugbox.yml index 5030963..aaaea89 100644 --- a/host_vars/lugbox.yml +++ b/host_vars/lugbox.yml @@ -13,8 +13,8 @@ dns_SOA: 2016041301 int_if: fxp0 ext_if: bge0 -boot_fname: -boot_next: +boot_fname: pxelinux.0 +boot_next: 192.168.1.1 ntp: - pool.ntp.org @@ -24,6 +24,10 @@ staticHosts: mac: 00:0f:b5:46:9c:c2 addr: 192.168.1.3 name: lug-cardboard + office01: + mac: c8:9c:dc:6d:20:ba + addr: 192.168.1.10 + name: office01 stub-zones: UTD: diff --git a/inventory b/inventory index 9a7ff3c..e3f10ab 100644 --- a/inventory +++ b/inventory @@ -1,9 +1,8 @@ [gateway] -lugbox cardboard -[utility] -alexandria +[void-deployment] +lugbox [webserver] lug.utdallas.edu @@ -12,4 +11,5 @@ lug.utdallas.edu lug-idler [workstation] +office01 lug01 diff --git a/roles/preseed-overlay b/roles/preseed-overlay new file mode 160000 index 0000000..05b37c7 --- /dev/null +++ b/roles/preseed-overlay @@ -0,0 +1 @@ +Subproject commit 05b37c7175f63ab2e810c1239e1eaa768c9f932a diff --git a/roles/void-deployment/files/autoinstall.cfg b/roles/void-deployment/files/autoinstall.cfg new file mode 100644 index 0000000..24ff294 --- /dev/null +++ b/roles/void-deployment/files/autoinstall.cfg @@ -0,0 +1,81 @@ +#!/bin/sh +# Void Linux Automatic Install Configuration + +# === +# Disk Configuration +# === +# disk: the disk to install to +# default: the first disk that isn't the installer +#disk=/dev/hda + +# bootpartitionsize: controls how large the boot partition will be +# default: 500M +#bootpartitionsize=500M + +# swapsize: how large should the swap partition be +# default: equal to the installed physical memory +#swapsize= + +# === +# XBPS Configuration +# === +# xbpsrepository: which repo should the install pull from +# default: http://repo.voidlinux.eu/current +#xbpsrepository="http://repo.voidlinux.eu/current" + +# pkgs: additional packages to install into the target +# default: none +#pkgs="" + +# === +# Default User +# === +# username: the username of the user to be created +# default: voidlinux +username="lug" + +# password: password to set for the new user +# default: unset (will prompt during install) +# Warning: This does not work in musl! +password="lug" + +# === +# Misc. Options +# === +# timezone: Timezone in TZ format +# default: America/Chicago +#timezone="America/Chicago" + +# keymap: Keymap to use by default +# default: us +#keymap="us" + +# locale: initial glibc locale +# default: en_US.UTF-8 +#libclocale=en.US.UTF-8 + +# hostname: static hostname for the system +# default: derived from DNS +#hostname=VoidLinux + +# end_action: what to do at the end of the install +# default: shutdown +# alternate values: reboot, script, func +#end_action=shutdown + +# end_script: script to optionally run at end of install +# the user script must reside somewhere xbps-uhelper fetch +# can retrieve it from +# default: not set +#end_script="" + +# end_function: a function to optionally be run at +# the end of the install. +end_function() { + printf "Linking default services" + chroot ${target} ln -s /etc/sv/dhcpcd /etc/runit/runsvdir/default/dhcpcd + chroot ${target} ln -s /etc/sv/sshd /etc/runit/runsvdir/default/sshd + + printf "Installing python" + xbps-install -r ${target} -R ${xbpsrepository} -Sy python +} diff --git a/roles/void-deployment/meta/main.yml b/roles/void-deployment/meta/main.yml new file mode 100644 index 0000000..3731ccf --- /dev/null +++ b/roles/void-deployment/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - { role: preseed-overlay } diff --git a/roles/void-deployment/tasks/main.yml b/roles/void-deployment/tasks/main.yml new file mode 100644 index 0000000..cf5ab20 --- /dev/null +++ b/roles/void-deployment/tasks/main.yml @@ -0,0 +1,9 @@ +--- +- name: Copy the void archive + copy: src=netboot.tar.gz dest=/srv/tftpboot/netboot.tar.gz owner=root group=wheel mode=0644 + +- name: Install the void archive + command: tar xvzf /srv/tftpboot/netboot.tar.gz -C /srv/tftpboot creates=/srv/tftpboot/pxelinux.0 + +- name: Copy the autoinstall.cfg + copy: src=autoinstall.cfg dest=/var/www/htdocs/preseed/autoinstall.cfg owner=root group=wheel mode=0644 diff --git a/void-deployment.yml b/void-deployment.yml new file mode 100644 index 0000000..623ecac --- /dev/null +++ b/void-deployment.yml @@ -0,0 +1,8 @@ +--- +- hosts: void-deployment + gather_facts: false + become: yes + become_method: doas + roles: + - gateway-base + - void-deployment