summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chaos-at-home/usb-install.yml2
-rw-r--r--common/usb-install.yml67
-rw-r--r--dan/usb-install.yml2
-rwxr-xr-xinstall.sh27
-rw-r--r--inventory/group_vars/elevate-festival/main.yml3
-rw-r--r--inventory/host_vars/ele-media.yml13
-rw-r--r--spreadspace/usb-install.yml2
l---------usb-install.sh1
l---------[-rwxr-xr-x]vm-install.sh28
9 files changed, 118 insertions, 27 deletions
diff --git a/chaos-at-home/usb-install.yml b/chaos-at-home/usb-install.yml
new file mode 100644
index 00000000..7912f21a
--- /dev/null
+++ b/chaos-at-home/usb-install.yml
@@ -0,0 +1,2 @@
+---
+- import_playbook: ../common/usb-install.yml
diff --git a/common/usb-install.yml b/common/usb-install.yml
new file mode 100644
index 00000000..7469fe2d
--- /dev/null
+++ b/common/usb-install.yml
@@ -0,0 +1,67 @@
+---
+- name: Fetch debian installer and bake initrd
+ hosts: "{{ hostname }}"
+ connection: local
+
+ vars_prompt:
+ - name: usbdrive_path
+ prompt: Where is the USB installation medium mounted to?
+ default: ""
+ private: no
+
+ pre_tasks:
+ - set_fact:
+ install_cooked: "{{ install }}"
+ network_cooked: "{{ network }}"
+ artifacts_dir: "{{ global_artifacts_dir }}/{{ hostname }}"
+ debian_installer_path: "{{ global_cache_dir }}/debian-installer"
+
+ - file:
+ state: directory
+ name: "{{ artifacts_dir }}"
+
+ roles:
+ - usb-install
+
+ tasks:
+ - stat:
+ path: "{{ usbdrive_path }}"
+ register: pathcheck
+
+ - when: pathcheck.stat.exists
+ block:
+ - name: Copy generated files to the USB drive
+ copy:
+ src: "{{ item }}"
+ dest: "{{ usbdrive_path }}/"
+ with_items:
+ - "{{ artifacts_dir }}/initrd.preseed.gz"
+ - "{{ global_cache_dir }}/debian-installer/{{ install_distro }}-{{ install_codename }}/{{ install.arch | default('amd64') }}/linux"
+ loop_control:
+ label: "{{ item | basename }}"
+
+ - name: Generate syslinux configuration
+ copy:
+ dest: "{{ usbdrive_path }}/syslinux.cfg"
+ content: |
+ DEFAULT linux
+ SAY SYSLINUX booting an automated installer for {{ hostname }}...
+ LABEL linux
+ KERNEL linux
+ INITRD initrd.preseed.gz
+ APPEND install vga=off console=ttyS0,115200n8
+
+ - name: Make the USB disk bootable
+ pause:
+ seconds: 0
+ prompt: |
+ You should make sure the USB disk is bootable and
+ has syslinux installed.
+
+ $ sudo apt install mbr syslinux
+ $ sudo install-mbr /dev/CHANGEME
+ $ sudo syslinux -i /dev/CHANGEME1
+ $ sudo fdisk /dev/CHANGEME
+ [Here, make sure partition 1 is marked bootable.]
+
+ This will NOT be done automatically.
diff --git a/dan/usb-install.yml b/dan/usb-install.yml
new file mode 100644
index 00000000..7912f21a
--- /dev/null
+++ b/dan/usb-install.yml
@@ -0,0 +1,2 @@
+---
+- import_playbook: ../common/usb-install.yml
diff --git a/install.sh b/install.sh
new file mode 100755
index 00000000..d60cc56e
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
+ echo "$0 <hostname> <distro> <codename>"
+ exit 1
+fi
+name=$1
+shift
+distro=$1
+shift
+codename=$1
+shift
+
+cd "${BASH_SOURCE%/*}"
+source common/utils.sh
+ansible_variable__get env_group "$name" || exit 1
+vault_environment__set "$env_group" || exit 1
+
+echo "installing $name with $distro/$codename in environment '$env_group'"
+echo ""
+
+echo "########## clearing old ssh host keys #########"
+./remove-known-host.sh "$name"
+echo ""
+
+echo "######## running the install playbook ########"
+exec ansible-playbook -e "hostname=$name" -e "install_distro=$distro" -e "install_codename=$codename" -e "hostenv=$env_group" $@ "$env_group/$(basename "$0" .sh).yml"
diff --git a/inventory/group_vars/elevate-festival/main.yml b/inventory/group_vars/elevate-festival/main.yml
index 52240b81..1144c068 100644
--- a/inventory/group_vars/elevate-festival/main.yml
+++ b/inventory/group_vars/elevate-festival/main.yml
@@ -9,6 +9,8 @@ network_zones:
dhcp:
start: 1
limit: 199
+ offsets:
+ ele-media: 200
guest:
vlan: 23
@@ -75,6 +77,7 @@ network_zones:
offsets:
## citycom uses offset 1,2 and 3
ele-router: 4
+ ele-media: 5
forum:
vlan: 109
diff --git a/inventory/host_vars/ele-media.yml b/inventory/host_vars/ele-media.yml
new file mode 100644
index 00000000..08cb9c39
--- /dev/null
+++ b/inventory/host_vars/ele-media.yml
@@ -0,0 +1,13 @@
+---
+network:
+ nameservers: "{{ network_zones.lan.dns }}"
+ domain: "{{ host_domain }}"
+ primary:
+ interface: enp1s0
+ ip: "{{ network_zones.lan.prefix | ipaddr(network_zones.lan.offsets[inventory_hostname]) | ipaddr('address') }}"
+ mask: "{{ network_zones.lan.prefix | ipaddr('netmask') }}"
+ gateway: "{{ network_zones.lan.gw }}"
+
+install:
+ disks:
+ primary: sda
diff --git a/spreadspace/usb-install.yml b/spreadspace/usb-install.yml
new file mode 100644
index 00000000..7912f21a
--- /dev/null
+++ b/spreadspace/usb-install.yml
@@ -0,0 +1,2 @@
+---
+- import_playbook: ../common/usb-install.yml
diff --git a/usb-install.sh b/usb-install.sh
new file mode 120000
index 00000000..61e71e22
--- /dev/null
+++ b/usb-install.sh
@@ -0,0 +1 @@
+install.sh \ No newline at end of file
diff --git a/vm-install.sh b/vm-install.sh
index e8893efa..61e71e22 100755..120000
--- a/vm-install.sh
+++ b/vm-install.sh
@@ -1,27 +1 @@
-#!/bin/bash
-
-if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
- echo "$0 <hostname> <distro> <codename>"
- exit 1
-fi
-name=$1
-shift
-distro=$1
-shift
-codename=$1
-shift
-
-cd "${BASH_SOURCE%/*}"
-source common/utils.sh
-ansible_variable__get env_group "$name" || exit 1
-vault_environment__set "$env_group" || exit 1
-
-echo "installing vm: $name with $distro/$codename in environment '$env_group'"
-echo ""
-
-echo "########## clearing old ssh host keys #########"
-./remove-known-host.sh "$name"
-echo ""
-
-echo "######## running the install playbook ########"
-exec ansible-playbook -e "hostname=$name" -e "install_distro=$distro" -e "install_codename=$codename" -e "hostenv=$env_group" $@ "$env_group/vm-install.yml"
+install.sh \ No newline at end of file