From 943864231aa4caf367ae86a066c1ef63c3d17d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Tue, 8 Jan 2019 19:45:19 -0800 Subject: Rename example-templates-configs to data-dir --- README.md | 4 +- .../data-dir/cloud-config/cloud-config-release.slc | 13 +++ configs/data-dir/cloud-config/users.slc | 11 +++ configs/data-dir/ipxe/centos.ipxe.slc | 14 +++ configs/data-dir/ipxe/coreos.ipxe.slc | 16 ++++ configs/data-dir/ipxe/debian.ipxe.slc | 16 ++++ configs/data-dir/ipxe/linux.cfg.slc | 15 +++ configs/data-dir/ipxe/storage.ipxe.slc | 16 ++++ configs/data-dir/ipxe/ubuntu-minimal.ipxe.slc | 16 ++++ configs/data-dir/kickstart/centos.ks.slc | 36 +++++++ configs/data-dir/mappings.yaml | 17 ++++ configs/data-dir/preseed/common.preseed.slc | 12 +++ configs/data-dir/preseed/debian.preseed.slc | 36 +++++++ configs/data-dir/preseed/storage.preseed.slc | 104 +++++++++++++++++++++ .../data-dir/preseed/ubuntu-minimal.preseed.slc | 36 +++++++ configs/data-dir/static/test-script | 3 + .../cloud-config/cloud-config-release.slc | 13 --- .../cloud-config/users.slc | 11 --- .../example-templates-configs/ipxe/centos.ipxe.slc | 14 --- .../example-templates-configs/ipxe/coreos.ipxe.slc | 16 ---- .../example-templates-configs/ipxe/debian.ipxe.slc | 16 ---- .../example-templates-configs/ipxe/linux.cfg.slc | 15 --- .../ipxe/storage.ipxe.slc | 16 ---- .../ipxe/ubuntu-minimal.ipxe.slc | 16 ---- .../kickstart/centos.ks.slc | 36 ------- configs/example-templates-configs/mappings.yaml | 17 ---- .../preseed/common.preseed.slc | 12 --- .../preseed/debian.preseed.slc | 36 ------- .../preseed/storage.preseed.slc | 104 --------------------- .../preseed/ubuntu-minimal.preseed.slc | 36 ------- .../example-templates-configs/static/test-script | 3 - configs/shoelaces.conf | 2 +- 32 files changed, 364 insertions(+), 364 deletions(-) create mode 100644 configs/data-dir/cloud-config/cloud-config-release.slc create mode 100644 configs/data-dir/cloud-config/users.slc create mode 100644 configs/data-dir/ipxe/centos.ipxe.slc create mode 100644 configs/data-dir/ipxe/coreos.ipxe.slc create mode 100644 configs/data-dir/ipxe/debian.ipxe.slc create mode 100644 configs/data-dir/ipxe/linux.cfg.slc create mode 100644 configs/data-dir/ipxe/storage.ipxe.slc create mode 100644 configs/data-dir/ipxe/ubuntu-minimal.ipxe.slc create mode 100644 configs/data-dir/kickstart/centos.ks.slc create mode 100644 configs/data-dir/mappings.yaml create mode 100644 configs/data-dir/preseed/common.preseed.slc create mode 100644 configs/data-dir/preseed/debian.preseed.slc create mode 100644 configs/data-dir/preseed/storage.preseed.slc create mode 100644 configs/data-dir/preseed/ubuntu-minimal.preseed.slc create mode 100644 configs/data-dir/static/test-script delete mode 100644 configs/example-templates-configs/cloud-config/cloud-config-release.slc delete mode 100644 configs/example-templates-configs/cloud-config/users.slc delete mode 100644 configs/example-templates-configs/ipxe/centos.ipxe.slc delete mode 100644 configs/example-templates-configs/ipxe/coreos.ipxe.slc delete mode 100644 configs/example-templates-configs/ipxe/debian.ipxe.slc delete mode 100644 configs/example-templates-configs/ipxe/linux.cfg.slc delete mode 100644 configs/example-templates-configs/ipxe/storage.ipxe.slc delete mode 100644 configs/example-templates-configs/ipxe/ubuntu-minimal.ipxe.slc delete mode 100644 configs/example-templates-configs/kickstart/centos.ks.slc delete mode 100644 configs/example-templates-configs/mappings.yaml delete mode 100644 configs/example-templates-configs/preseed/common.preseed.slc delete mode 100644 configs/example-templates-configs/preseed/debian.preseed.slc delete mode 100644 configs/example-templates-configs/preseed/storage.preseed.slc delete mode 100644 configs/example-templates-configs/preseed/ubuntu-minimal.preseed.slc delete mode 100644 configs/example-templates-configs/static/test-script diff --git a/README.md b/README.md index a1309ae..1bfe2d8 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Shoelaces accepts several parameters: * `config`: the path to a configuration file. * `data-dir`: the path to the root directory with the templates. It's advised to manage the templates in a VCS, such as a git repository. Refer to the [example - data directory](configs/example-templates-configs/) for more information. + data directory](configs/data-dir/) for more information. * `debug`: enable debug messages. * `domain`: the domain Shoelaces is going to be listening on. * `mappings-file`: the path to the YAML mappings file, relative to the `data-dir` parameter. @@ -178,7 +178,7 @@ that. Shoelaces will read these mappings from a YAML file that can be passed as a program parameter. Refer to the [example mappings -file](configs/example-templates-configs/mappings.yaml) for more information. +file](configs/data-dir/mappings.yaml) for more information. ## Environments diff --git a/configs/data-dir/cloud-config/cloud-config-release.slc b/configs/data-dir/cloud-config/cloud-config-release.slc new file mode 100644 index 0000000..0f3de35 --- /dev/null +++ b/configs/data-dir/cloud-config/cloud-config-release.slc @@ -0,0 +1,13 @@ +{{define "cloudconfig-coreos" -}} +#cloud-config +{{template "cloudconfig-coreos-users"}} + +hostname:{{.hostname}} +coreos: + update: + reboot-strategy: off + units: + - name: update-engine.service + enable: true + command: start +{{end}} diff --git a/configs/data-dir/cloud-config/users.slc b/configs/data-dir/cloud-config/users.slc new file mode 100644 index 0000000..6ebdd3f --- /dev/null +++ b/configs/data-dir/cloud-config/users.slc @@ -0,0 +1,11 @@ +{{define "cloudconfig-coreos-users"}} +users: + - name: "shoelaces" + groups: + - "sudo" + - "docker" + ssh-authorized-keys: + - "ssh-rsa fake-key shoelaces@example.com" +ssh_authorized_keys: + - "ssh-rsa fake-key shoelaces@example.com" +{{end}} diff --git a/configs/data-dir/ipxe/centos.ipxe.slc b/configs/data-dir/ipxe/centos.ipxe.slc new file mode 100644 index 0000000..88b3fc2 --- /dev/null +++ b/configs/data-dir/ipxe/centos.ipxe.slc @@ -0,0 +1,14 @@ +{{define "centos.ipxe" -}} +#!ipxe +set hostname {{.hostname}} +set release {{.release}} +set base http://mirror.centos.org/centos/${release}/os/x86_64 + +echo This automatically overwrites data! +echo CentOS ${release} +echo Installing ${hostname} + +kernel ${base}/images/pxeboot/vmlinuz initrd=initrd.img repo=${base} ks=http://{{.baseURL}}/configs/centos.ks?hostname=${hostname}&release=${release} +initrd ${base}/images/pxeboot/initrd.img +boot +{{end}} diff --git a/configs/data-dir/ipxe/coreos.ipxe.slc b/configs/data-dir/ipxe/coreos.ipxe.slc new file mode 100644 index 0000000..64685ff --- /dev/null +++ b/configs/data-dir/ipxe/coreos.ipxe.slc @@ -0,0 +1,16 @@ +{{define "coreos.ipxe" -}} +#!ipxe + +set coreos-url http://stable.release.core-os.net/amd64-usr/current + +echo This will currently autologin into tty1 on the console. +echo From there you can su to root and install CoreOS to disk using: +echo coreos-install -d /dev/sda -C {{.release}} +echo You will probably need to chroot into /dev/sda9 to configure accounts. +echo More info @ http://coreos.com/docs/running-coreos/bare-metal/installing-to-disk/ + +kernel ${coreos-url}/coreos_production_pxe.vmlinuz cloud-config-url=http://{{.baseURL}}/configs/cloudconfig-coreos?release={{.release}}&hostname={{.hostname}} console=tty1 coreos.autologin=tty1 +initrd ${coreos-url}/coreos_production_pxe_image.cpio.gz + +boot +{{end}} \ No newline at end of file diff --git a/configs/data-dir/ipxe/debian.ipxe.slc b/configs/data-dir/ipxe/debian.ipxe.slc new file mode 100644 index 0000000..8717d5e --- /dev/null +++ b/configs/data-dir/ipxe/debian.ipxe.slc @@ -0,0 +1,16 @@ +{{define "debian.ipxe" -}} +#!ipxe + +echo This automatically overwrites data! +echo Debian {{.release}} + +set mirror http://ftp.debian.org/debian/dists/{{.release}}/main/installer-amd64/current/images/netboot/debian-installer/amd64 + +chain http://{{.baseURL}}/configs/linux.cfg?hostname={{.hostname}} + +imgfree + +kernel ${mirror}/linux auto=true priority=critical initrd=initrd.gz keyboard-configuration/xkb-keymap=us preseed/url=http://{{.baseURL}}/configs/debian.preseed ${linuxargs} +initrd ${mirror}/initrd.gz +boot +{{end}} diff --git a/configs/data-dir/ipxe/linux.cfg.slc b/configs/data-dir/ipxe/linux.cfg.slc new file mode 100644 index 0000000..512f7f2 --- /dev/null +++ b/configs/data-dir/ipxe/linux.cfg.slc @@ -0,0 +1,15 @@ +{{define "linux.cfg" -}} +#!ipxe + +# We set VGA to normal and nomodeset because often the framebuffers +# are extraordinarily slow. + +# Two serial interfaces enabled, hopefully one for local and one for remote +# on Dells with iDRAC/iKVM (serial over lan). + +# libata.force=noncq for https://bbs.archlinux.org/viewtopic.php?id=196267 +# We probably want ncq for harddrives, but we don't have many of those. +# queued trim is broken with our 850PRO/Linux combo, or maybe entirely on the Samsung 850 PRO SSDs + +set linuxargs hostname={{.hostname}} console=tty0 console=ttyS0,115200n8 console=ttyS1,115200n8 vga=normal biosdevname=0 nomodeset interface=auto libata.force=noncq consoleblank=0 +{{end}} \ No newline at end of file diff --git a/configs/data-dir/ipxe/storage.ipxe.slc b/configs/data-dir/ipxe/storage.ipxe.slc new file mode 100644 index 0000000..457dad7 --- /dev/null +++ b/configs/data-dir/ipxe/storage.ipxe.slc @@ -0,0 +1,16 @@ +{{define "storage.ipxe" -}} +#!ipxe + +echo This automatically overwrites data! +echo Ubuntu {{.release}} amd64 storage + +set mirror http://mirror.rackspace.com/ubuntu/dists/{{.release}}/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64 + +chain --autofree http://{{.baseURL}}/configs/linux.cfg?hostname={{.hostname}} + +imgfree + +kernel ${mirror}/linux auto=true priority=critical initrd=initrd.gz preseed/url=http://{{.baseURL}}/configs/storage.preseed ${linuxargs} +initrd ${mirror}/initrd.gz +boot +{{end}} \ No newline at end of file diff --git a/configs/data-dir/ipxe/ubuntu-minimal.ipxe.slc b/configs/data-dir/ipxe/ubuntu-minimal.ipxe.slc new file mode 100644 index 0000000..e52f63c --- /dev/null +++ b/configs/data-dir/ipxe/ubuntu-minimal.ipxe.slc @@ -0,0 +1,16 @@ +{{define "ubuntu-minimal.ipxe" -}} +#!ipxe + +echo This automatically overwrites data! +echo Ubuntu {{.release}} minimal + +set mirror http://mirror.rackspace.com/ubuntu/dists/{{.release}}/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64 + +chain http://{{.baseURL}}/configs/linux.cfg?hostname={{.hostname}} + +imgfree + +kernel ${mirror}/linux auto=true priority=critical initrd=initrd.gz preseed/url=http://{{.baseURL}}/configs/ubuntu-minimal.preseed ${linuxargs} +initrd ${mirror}/initrd.gz +boot +{{end}} diff --git a/configs/data-dir/kickstart/centos.ks.slc b/configs/data-dir/kickstart/centos.ks.slc new file mode 100644 index 0000000..04d5455 --- /dev/null +++ b/configs/data-dir/kickstart/centos.ks.slc @@ -0,0 +1,36 @@ +{{define "centos.ks" -}} +logging --level=info +cmdline + +url --url="http://mirror.netcologne.de/centos/{{.release}}/os/x86_64" + +network --bootproto dhcp --hostname {{.hostname}} + +rootpw root +auth --useshadow --passalgo=sha512 --enablefingerprint + +keyboard --vckeymap=de --xlayouts='de (nodeadkeys)' +lang en_US.UTF-8 +timezone Europe/Berlin --isUtc +zerombr +clearpart --drives=sda --all --disklabel=gpt +bootloader --append="crashkernel=auto panic=60" --location=mbr +part biosboot --fstype=biosboot --size=1 +part /boot --fstype="ext4" --ondisk=sda --size=500 --label=/boot +part swap --fstype="swap" --ondisk=sda --size=8000 +part pv.01 --size=1000 --grow --ondisk=sda +volgroup vg0 pv.01 +logvol / --fstype="ext4" --vgname=vg0 --size=10000 --name=lv_root --grow + +%packages +@core +%end + +%post +#!/bin/bash +hostnamectl set-hostname {{.hostname}} +echo -e "\n#######################\n # Finished Post Tasks\n#######################\n" +sleep 5 +%end +reboot +{{end}} \ No newline at end of file diff --git a/configs/data-dir/mappings.yaml b/configs/data-dir/mappings.yaml new file mode 100644 index 0000000..dfcb8c9 --- /dev/null +++ b/configs/data-dir/mappings.yaml @@ -0,0 +1,17 @@ +networkMaps: + - network: 192.168.0.0/24 + script: + name: ubuntu-minimal.ipxe + params: + release: xenial + - network: 10.0.10.0/24 + script: + name: coreos.ipxe + params: + release: stable +hostnameMaps: + - hostname: msc1.example.com + script: + name: ubuntu-minimal.ipxe + params: + release: trusty diff --git a/configs/data-dir/preseed/common.preseed.slc b/configs/data-dir/preseed/common.preseed.slc new file mode 100644 index 0000000..bcbf98b --- /dev/null +++ b/configs/data-dir/preseed/common.preseed.slc @@ -0,0 +1,12 @@ +{{define "common.preseed"}} +d-i auto-install/enable boolean true +d-i debian-installer/locale string en_US +d-i console-setup/ask_detect boolean false + +d-i user-setup/allow-password-weak boolean true +d-i passwd/root-login boolean true +d-i passwd/make-user boolean false + +d-i passwd/root-password password password +d-i passwd/root-password-again password password +{{end}} \ No newline at end of file diff --git a/configs/data-dir/preseed/debian.preseed.slc b/configs/data-dir/preseed/debian.preseed.slc new file mode 100644 index 0000000..0915fe3 --- /dev/null +++ b/configs/data-dir/preseed/debian.preseed.slc @@ -0,0 +1,36 @@ +{{define "debian.preseed" -}} +{{template "common.preseed"}} + +d-i partman-auto/method string regular +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 + +# atomic: Just one partition +d-i partman-auto/choose_recipe select atomic + +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 user-setup/encrypt-home boolean false + +d-i base-installer/install-recommends boolean true + +d-i clock-setup/utc boolean true +d-i time/zone string America/Los_Angeles + +d-i clock-setup/ntp boolean true + +d-i debian-installer/quiet boolean false +d-i debian-installer/splash boolean false + +d-i pkgsel/update-policy select unattended-upgrades + +d-i grub-installer/timeout string 5 +d-i popularity-contest/participate boolean false + +d-i finish-install/reboot_in_progress note +{{end}} diff --git a/configs/data-dir/preseed/storage.preseed.slc b/configs/data-dir/preseed/storage.preseed.slc new file mode 100644 index 0000000..982b41b --- /dev/null +++ b/configs/data-dir/preseed/storage.preseed.slc @@ -0,0 +1,104 @@ +{{define "storage.preseed" -}} +{{template "common.preseed"}} + +# The method should be set to "raid". +d-i partman-auto/method string raid +# Specify the disks to be partitioned. They will all get the same layout, +# so this will only work if the disks are the same size. +d-i partman-auto/disk string /dev/sda /dev/sdb + +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-lvm/device_remove_lvm_span boolean true +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-lvm/confirm boolean true +d-i partman-auto-lvm/new_vg_name string vg0 + +# Next you need to specify the physical partitions that will be used. +d-i partman-auto/expert_recipe string \ + multiraid :: \ + 256 512 1024 raid \ + $lvmignore{ } \ + $primary{ } \ + method{ raid } \ + raidid{ 1 } \ + . \ + 4000 4096 -1 raid \ + $lvmignore{ } \ + method{ raid } \ + raidid{ 2 } \ + . \ + 2000 4096 50000 ext4 \ + $defaultignore{ } \ + $lvmok{ } \ + method{ format } \ + format{ } \ + use_filesystem{ } \ + filesystem{ ext4 } \ + mountpoint{ / } \ + lv_name{ root } \ + options/noatime{ noatime } \ + options/nodiratime{ nodiratime } \ + options/discard{ discard } \ + . \ + 100% 512 100% linux-swap \ + $defaultignore{ } \ + $lvmok{ } \ + method{ swap } \ + format{ } \ + lv_name{ swap } \ + . + + +# Last you need to specify how the previously defined partitions will be +# used in the RAID setup. Remember to use the correct partition numbers +# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported; +# devices are separated using "#". +# Parameters are: +# \ +# + +d-i partman-auto-raid/recipe string \ + 1 2 0 ext3 /boot \ + raidid=1 \ + . \ + 1 2 0 lvm - \ + raidid=2 \ + . + + + +d-i mdadm/boot_degraded boolean true +d-i partman-md/confirm boolean true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select Finish partitioning and write changes to disk +d-i partman/confirm boolean true +d-i partman-md/confirm_nooverwrite boolean true +d-i partman/confirm_nooverwrite boolean true + +d-i user-setup/encrypt-home boolean false + +d-i base-installer/install-recommends boolean false + +d-i clock-setup/utc boolean true +d-i time/zone string UTC + +d-i clock-setup/ntp boolean true + +d-i debian-installer/quiet boolean false +d-i debian-installer/splash boolean false + +##This should be set by Puppet instead. +d-i pkgsel/update-policy select none +## + +d-i grub-installer/timeout string 5 +d-i popularity-contest/participate boolean false + + +d-i finish-install/keep-consoles boolean true +d-i finish-install/reboot_in_progress note + +# This just halts, we want a reboot. +#d-i debian-installer/exit/poweroff boolean true +{{end}} diff --git a/configs/data-dir/preseed/ubuntu-minimal.preseed.slc b/configs/data-dir/preseed/ubuntu-minimal.preseed.slc new file mode 100644 index 0000000..2138764 --- /dev/null +++ b/configs/data-dir/preseed/ubuntu-minimal.preseed.slc @@ -0,0 +1,36 @@ +{{define "ubuntu-minimal.preseed" -}} +{{template "common.preseed"}} + +d-i partman-auto/method string regular +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 + +# atomic: Just one partition +d-i partman-auto/choose_recipe select atomic + +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 user-setup/encrypt-home boolean false + +d-i base-installer/install-recommends boolean true + +d-i clock-setup/utc boolean true +d-i time/zone string America/Los_Angeles + +d-i clock-setup/ntp boolean true + +d-i debian-installer/quiet boolean false +d-i debian-installer/splash boolean false + +d-i pkgsel/update-policy select unattended-upgrades + +d-i grub-installer/timeout string 5 +d-i popularity-contest/participate boolean false + +d-i finish-install/reboot_in_progress note +{{end}} diff --git a/configs/data-dir/static/test-script b/configs/data-dir/static/test-script new file mode 100644 index 0000000..8c33db6 --- /dev/null +++ b/configs/data-dir/static/test-script @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Hello world" diff --git a/configs/example-templates-configs/cloud-config/cloud-config-release.slc b/configs/example-templates-configs/cloud-config/cloud-config-release.slc deleted file mode 100644 index 0f3de35..0000000 --- a/configs/example-templates-configs/cloud-config/cloud-config-release.slc +++ /dev/null @@ -1,13 +0,0 @@ -{{define "cloudconfig-coreos" -}} -#cloud-config -{{template "cloudconfig-coreos-users"}} - -hostname:{{.hostname}} -coreos: - update: - reboot-strategy: off - units: - - name: update-engine.service - enable: true - command: start -{{end}} diff --git a/configs/example-templates-configs/cloud-config/users.slc b/configs/example-templates-configs/cloud-config/users.slc deleted file mode 100644 index 6ebdd3f..0000000 --- a/configs/example-templates-configs/cloud-config/users.slc +++ /dev/null @@ -1,11 +0,0 @@ -{{define "cloudconfig-coreos-users"}} -users: - - name: "shoelaces" - groups: - - "sudo" - - "docker" - ssh-authorized-keys: - - "ssh-rsa fake-key shoelaces@example.com" -ssh_authorized_keys: - - "ssh-rsa fake-key shoelaces@example.com" -{{end}} diff --git a/configs/example-templates-configs/ipxe/centos.ipxe.slc b/configs/example-templates-configs/ipxe/centos.ipxe.slc deleted file mode 100644 index 88b3fc2..0000000 --- a/configs/example-templates-configs/ipxe/centos.ipxe.slc +++ /dev/null @@ -1,14 +0,0 @@ -{{define "centos.ipxe" -}} -#!ipxe -set hostname {{.hostname}} -set release {{.release}} -set base http://mirror.centos.org/centos/${release}/os/x86_64 - -echo This automatically overwrites data! -echo CentOS ${release} -echo Installing ${hostname} - -kernel ${base}/images/pxeboot/vmlinuz initrd=initrd.img repo=${base} ks=http://{{.baseURL}}/configs/centos.ks?hostname=${hostname}&release=${release} -initrd ${base}/images/pxeboot/initrd.img -boot -{{end}} diff --git a/configs/example-templates-configs/ipxe/coreos.ipxe.slc b/configs/example-templates-configs/ipxe/coreos.ipxe.slc deleted file mode 100644 index 64685ff..0000000 --- a/configs/example-templates-configs/ipxe/coreos.ipxe.slc +++ /dev/null @@ -1,16 +0,0 @@ -{{define "coreos.ipxe" -}} -#!ipxe - -set coreos-url http://stable.release.core-os.net/amd64-usr/current - -echo This will currently autologin into tty1 on the console. -echo From there you can su to root and install CoreOS to disk using: -echo coreos-install -d /dev/sda -C {{.release}} -echo You will probably need to chroot into /dev/sda9 to configure accounts. -echo More info @ http://coreos.com/docs/running-coreos/bare-metal/installing-to-disk/ - -kernel ${coreos-url}/coreos_production_pxe.vmlinuz cloud-config-url=http://{{.baseURL}}/configs/cloudconfig-coreos?release={{.release}}&hostname={{.hostname}} console=tty1 coreos.autologin=tty1 -initrd ${coreos-url}/coreos_production_pxe_image.cpio.gz - -boot -{{end}} \ No newline at end of file diff --git a/configs/example-templates-configs/ipxe/debian.ipxe.slc b/configs/example-templates-configs/ipxe/debian.ipxe.slc deleted file mode 100644 index 8717d5e..0000000 --- a/configs/example-templates-configs/ipxe/debian.ipxe.slc +++ /dev/null @@ -1,16 +0,0 @@ -{{define "debian.ipxe" -}} -#!ipxe - -echo This automatically overwrites data! -echo Debian {{.release}} - -set mirror http://ftp.debian.org/debian/dists/{{.release}}/main/installer-amd64/current/images/netboot/debian-installer/amd64 - -chain http://{{.baseURL}}/configs/linux.cfg?hostname={{.hostname}} - -imgfree - -kernel ${mirror}/linux auto=true priority=critical initrd=initrd.gz keyboard-configuration/xkb-keymap=us preseed/url=http://{{.baseURL}}/configs/debian.preseed ${linuxargs} -initrd ${mirror}/initrd.gz -boot -{{end}} diff --git a/configs/example-templates-configs/ipxe/linux.cfg.slc b/configs/example-templates-configs/ipxe/linux.cfg.slc deleted file mode 100644 index 512f7f2..0000000 --- a/configs/example-templates-configs/ipxe/linux.cfg.slc +++ /dev/null @@ -1,15 +0,0 @@ -{{define "linux.cfg" -}} -#!ipxe - -# We set VGA to normal and nomodeset because often the framebuffers -# are extraordinarily slow. - -# Two serial interfaces enabled, hopefully one for local and one for remote -# on Dells with iDRAC/iKVM (serial over lan). - -# libata.force=noncq for https://bbs.archlinux.org/viewtopic.php?id=196267 -# We probably want ncq for harddrives, but we don't have many of those. -# queued trim is broken with our 850PRO/Linux combo, or maybe entirely on the Samsung 850 PRO SSDs - -set linuxargs hostname={{.hostname}} console=tty0 console=ttyS0,115200n8 console=ttyS1,115200n8 vga=normal biosdevname=0 nomodeset interface=auto libata.force=noncq consoleblank=0 -{{end}} \ No newline at end of file diff --git a/configs/example-templates-configs/ipxe/storage.ipxe.slc b/configs/example-templates-configs/ipxe/storage.ipxe.slc deleted file mode 100644 index 457dad7..0000000 --- a/configs/example-templates-configs/ipxe/storage.ipxe.slc +++ /dev/null @@ -1,16 +0,0 @@ -{{define "storage.ipxe" -}} -#!ipxe - -echo This automatically overwrites data! -echo Ubuntu {{.release}} amd64 storage - -set mirror http://mirror.rackspace.com/ubuntu/dists/{{.release}}/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64 - -chain --autofree http://{{.baseURL}}/configs/linux.cfg?hostname={{.hostname}} - -imgfree - -kernel ${mirror}/linux auto=true priority=critical initrd=initrd.gz preseed/url=http://{{.baseURL}}/configs/storage.preseed ${linuxargs} -initrd ${mirror}/initrd.gz -boot -{{end}} \ No newline at end of file diff --git a/configs/example-templates-configs/ipxe/ubuntu-minimal.ipxe.slc b/configs/example-templates-configs/ipxe/ubuntu-minimal.ipxe.slc deleted file mode 100644 index e52f63c..0000000 --- a/configs/example-templates-configs/ipxe/ubuntu-minimal.ipxe.slc +++ /dev/null @@ -1,16 +0,0 @@ -{{define "ubuntu-minimal.ipxe" -}} -#!ipxe - -echo This automatically overwrites data! -echo Ubuntu {{.release}} minimal - -set mirror http://mirror.rackspace.com/ubuntu/dists/{{.release}}/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64 - -chain http://{{.baseURL}}/configs/linux.cfg?hostname={{.hostname}} - -imgfree - -kernel ${mirror}/linux auto=true priority=critical initrd=initrd.gz preseed/url=http://{{.baseURL}}/configs/ubuntu-minimal.preseed ${linuxargs} -initrd ${mirror}/initrd.gz -boot -{{end}} diff --git a/configs/example-templates-configs/kickstart/centos.ks.slc b/configs/example-templates-configs/kickstart/centos.ks.slc deleted file mode 100644 index 04d5455..0000000 --- a/configs/example-templates-configs/kickstart/centos.ks.slc +++ /dev/null @@ -1,36 +0,0 @@ -{{define "centos.ks" -}} -logging --level=info -cmdline - -url --url="http://mirror.netcologne.de/centos/{{.release}}/os/x86_64" - -network --bootproto dhcp --hostname {{.hostname}} - -rootpw root -auth --useshadow --passalgo=sha512 --enablefingerprint - -keyboard --vckeymap=de --xlayouts='de (nodeadkeys)' -lang en_US.UTF-8 -timezone Europe/Berlin --isUtc -zerombr -clearpart --drives=sda --all --disklabel=gpt -bootloader --append="crashkernel=auto panic=60" --location=mbr -part biosboot --fstype=biosboot --size=1 -part /boot --fstype="ext4" --ondisk=sda --size=500 --label=/boot -part swap --fstype="swap" --ondisk=sda --size=8000 -part pv.01 --size=1000 --grow --ondisk=sda -volgroup vg0 pv.01 -logvol / --fstype="ext4" --vgname=vg0 --size=10000 --name=lv_root --grow - -%packages -@core -%end - -%post -#!/bin/bash -hostnamectl set-hostname {{.hostname}} -echo -e "\n#######################\n # Finished Post Tasks\n#######################\n" -sleep 5 -%end -reboot -{{end}} \ No newline at end of file diff --git a/configs/example-templates-configs/mappings.yaml b/configs/example-templates-configs/mappings.yaml deleted file mode 100644 index dfcb8c9..0000000 --- a/configs/example-templates-configs/mappings.yaml +++ /dev/null @@ -1,17 +0,0 @@ -networkMaps: - - network: 192.168.0.0/24 - script: - name: ubuntu-minimal.ipxe - params: - release: xenial - - network: 10.0.10.0/24 - script: - name: coreos.ipxe - params: - release: stable -hostnameMaps: - - hostname: msc1.example.com - script: - name: ubuntu-minimal.ipxe - params: - release: trusty diff --git a/configs/example-templates-configs/preseed/common.preseed.slc b/configs/example-templates-configs/preseed/common.preseed.slc deleted file mode 100644 index bcbf98b..0000000 --- a/configs/example-templates-configs/preseed/common.preseed.slc +++ /dev/null @@ -1,12 +0,0 @@ -{{define "common.preseed"}} -d-i auto-install/enable boolean true -d-i debian-installer/locale string en_US -d-i console-setup/ask_detect boolean false - -d-i user-setup/allow-password-weak boolean true -d-i passwd/root-login boolean true -d-i passwd/make-user boolean false - -d-i passwd/root-password password password -d-i passwd/root-password-again password password -{{end}} \ No newline at end of file diff --git a/configs/example-templates-configs/preseed/debian.preseed.slc b/configs/example-templates-configs/preseed/debian.preseed.slc deleted file mode 100644 index 0915fe3..0000000 --- a/configs/example-templates-configs/preseed/debian.preseed.slc +++ /dev/null @@ -1,36 +0,0 @@ -{{define "debian.preseed" -}} -{{template "common.preseed"}} - -d-i partman-auto/method string regular -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 - -# atomic: Just one partition -d-i partman-auto/choose_recipe select atomic - -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 user-setup/encrypt-home boolean false - -d-i base-installer/install-recommends boolean true - -d-i clock-setup/utc boolean true -d-i time/zone string America/Los_Angeles - -d-i clock-setup/ntp boolean true - -d-i debian-installer/quiet boolean false -d-i debian-installer/splash boolean false - -d-i pkgsel/update-policy select unattended-upgrades - -d-i grub-installer/timeout string 5 -d-i popularity-contest/participate boolean false - -d-i finish-install/reboot_in_progress note -{{end}} diff --git a/configs/example-templates-configs/preseed/storage.preseed.slc b/configs/example-templates-configs/preseed/storage.preseed.slc deleted file mode 100644 index 982b41b..0000000 --- a/configs/example-templates-configs/preseed/storage.preseed.slc +++ /dev/null @@ -1,104 +0,0 @@ -{{define "storage.preseed" -}} -{{template "common.preseed"}} - -# The method should be set to "raid". -d-i partman-auto/method string raid -# Specify the disks to be partitioned. They will all get the same layout, -# so this will only work if the disks are the same size. -d-i partman-auto/disk string /dev/sda /dev/sdb - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-lvm/device_remove_lvm_span boolean true -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-md/device_remove_md boolean true -d-i partman-lvm/confirm boolean true -d-i partman-auto-lvm/new_vg_name string vg0 - -# Next you need to specify the physical partitions that will be used. -d-i partman-auto/expert_recipe string \ - multiraid :: \ - 256 512 1024 raid \ - $lvmignore{ } \ - $primary{ } \ - method{ raid } \ - raidid{ 1 } \ - . \ - 4000 4096 -1 raid \ - $lvmignore{ } \ - method{ raid } \ - raidid{ 2 } \ - . \ - 2000 4096 50000 ext4 \ - $defaultignore{ } \ - $lvmok{ } \ - method{ format } \ - format{ } \ - use_filesystem{ } \ - filesystem{ ext4 } \ - mountpoint{ / } \ - lv_name{ root } \ - options/noatime{ noatime } \ - options/nodiratime{ nodiratime } \ - options/discard{ discard } \ - . \ - 100% 512 100% linux-swap \ - $defaultignore{ } \ - $lvmok{ } \ - method{ swap } \ - format{ } \ - lv_name{ swap } \ - . - - -# Last you need to specify how the previously defined partitions will be -# used in the RAID setup. Remember to use the correct partition numbers -# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported; -# devices are separated using "#". -# Parameters are: -# \ -# - -d-i partman-auto-raid/recipe string \ - 1 2 0 ext3 /boot \ - raidid=1 \ - . \ - 1 2 0 lvm - \ - raidid=2 \ - . - - - -d-i mdadm/boot_degraded boolean true -d-i partman-md/confirm boolean true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select Finish partitioning and write changes to disk -d-i partman/confirm boolean true -d-i partman-md/confirm_nooverwrite boolean true -d-i partman/confirm_nooverwrite boolean true - -d-i user-setup/encrypt-home boolean false - -d-i base-installer/install-recommends boolean false - -d-i clock-setup/utc boolean true -d-i time/zone string UTC - -d-i clock-setup/ntp boolean true - -d-i debian-installer/quiet boolean false -d-i debian-installer/splash boolean false - -##This should be set by Puppet instead. -d-i pkgsel/update-policy select none -## - -d-i grub-installer/timeout string 5 -d-i popularity-contest/participate boolean false - - -d-i finish-install/keep-consoles boolean true -d-i finish-install/reboot_in_progress note - -# This just halts, we want a reboot. -#d-i debian-installer/exit/poweroff boolean true -{{end}} diff --git a/configs/example-templates-configs/preseed/ubuntu-minimal.preseed.slc b/configs/example-templates-configs/preseed/ubuntu-minimal.preseed.slc deleted file mode 100644 index 2138764..0000000 --- a/configs/example-templates-configs/preseed/ubuntu-minimal.preseed.slc +++ /dev/null @@ -1,36 +0,0 @@ -{{define "ubuntu-minimal.preseed" -}} -{{template "common.preseed"}} - -d-i partman-auto/method string regular -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 - -# atomic: Just one partition -d-i partman-auto/choose_recipe select atomic - -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 user-setup/encrypt-home boolean false - -d-i base-installer/install-recommends boolean true - -d-i clock-setup/utc boolean true -d-i time/zone string America/Los_Angeles - -d-i clock-setup/ntp boolean true - -d-i debian-installer/quiet boolean false -d-i debian-installer/splash boolean false - -d-i pkgsel/update-policy select unattended-upgrades - -d-i grub-installer/timeout string 5 -d-i popularity-contest/participate boolean false - -d-i finish-install/reboot_in_progress note -{{end}} diff --git a/configs/example-templates-configs/static/test-script b/configs/example-templates-configs/static/test-script deleted file mode 100644 index 8c33db6..0000000 --- a/configs/example-templates-configs/static/test-script +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo "Hello world" diff --git a/configs/shoelaces.conf b/configs/shoelaces.conf index fd4230f..b4ed606 100644 --- a/configs/shoelaces.conf +++ b/configs/shoelaces.conf @@ -1,6 +1,6 @@ port=8081 domain=localhost -data-dir=configs/example-templates-configs/ +data-dir=configs/data-dir/ template-extension=.slc mappings-file=mappings.yaml debug=true -- cgit v1.2.3 From b27b7bfd4e95b35a5dbce225ac135287a8bbdb24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Tue, 8 Jan 2019 19:48:29 -0800 Subject: Move screenshots to docs/screenshots --- README.md | 6 +++--- docs/screenshots/shoelaces-frontend-1.png | Bin 0 -> 49354 bytes docs/screenshots/shoelaces-frontend-2.png | Bin 0 -> 38786 bytes docs/screenshots/shoelaces-overview.png | Bin 0 -> 21554 bytes shoelaces-frontend-1.png | Bin 49354 -> 0 bytes shoelaces-frontend-2.png | Bin 38786 -> 0 bytes shoelaces-overview.png | Bin 21554 -> 0 bytes 7 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 docs/screenshots/shoelaces-frontend-1.png create mode 100644 docs/screenshots/shoelaces-frontend-2.png create mode 100644 docs/screenshots/shoelaces-overview.png delete mode 100644 shoelaces-frontend-1.png delete mode 100644 shoelaces-frontend-2.png delete mode 100644 shoelaces-overview.png diff --git a/README.md b/README.md index 1bfe2d8..a76ef52 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ As soon as Shoelaces starts, the service will be patiently waiting for servers to boot. If no servers are detected, you'll simply see a spinner in the web UI, as can be seen in the screenshot. -![Shoelaces frontend - Waiting for hosts](shoelaces-frontend-1.png) +![Shoelaces frontend - Waiting for hosts](docs/screenshots/shoelaces-frontend-1.png) The URL `localhost:8081` will actually point to wherever you are running your Shoelaces instance. It must be reachable by the booting hosts. @@ -30,7 +30,7 @@ Shoelaces instance. It must be reachable by the booting hosts. The following picture shows a high level overview of how a server notifies Shoelaces that it's ready for booting. -![Shoelaces overview](shoelaces-overview.png) +![Shoelaces overview](docs/screenshots/shoelaces-overview.png) In this graph we can see that as soon as the server boots using network boot, we instruct the machine to switch to an [iPXE](https://ipxe.org/) ROM. We do this @@ -50,7 +50,7 @@ guessed, will be pointing to Shoelaces. If there was no automated installation configured for the booting server, you'll be able to select an option to bootstrap it in the Shoelaces UI. -![Shoelaces frontend - Host detected](shoelaces-frontend-2.png) +![Shoelaces frontend - Host detected](docs/screenshots/shoelaces-frontend-2.png) A couple of things can be said about this screenshot: diff --git a/docs/screenshots/shoelaces-frontend-1.png b/docs/screenshots/shoelaces-frontend-1.png new file mode 100644 index 0000000..96518e9 Binary files /dev/null and b/docs/screenshots/shoelaces-frontend-1.png differ diff --git a/docs/screenshots/shoelaces-frontend-2.png b/docs/screenshots/shoelaces-frontend-2.png new file mode 100644 index 0000000..4864303 Binary files /dev/null and b/docs/screenshots/shoelaces-frontend-2.png differ diff --git a/docs/screenshots/shoelaces-overview.png b/docs/screenshots/shoelaces-overview.png new file mode 100644 index 0000000..812fa8b Binary files /dev/null and b/docs/screenshots/shoelaces-overview.png differ diff --git a/shoelaces-frontend-1.png b/shoelaces-frontend-1.png deleted file mode 100644 index 96518e9..0000000 Binary files a/shoelaces-frontend-1.png and /dev/null differ diff --git a/shoelaces-frontend-2.png b/shoelaces-frontend-2.png deleted file mode 100644 index 4864303..0000000 Binary files a/shoelaces-frontend-2.png and /dev/null differ diff --git a/shoelaces-overview.png b/shoelaces-overview.png deleted file mode 100644 index 812fa8b..0000000 Binary files a/shoelaces-overview.png and /dev/null differ -- cgit v1.2.3 From 5e8ae5156c72593eb24dd125db32e860f59be820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Tue, 8 Jan 2019 21:00:42 -0800 Subject: Add scdoc manpage --- .gitignore | 3 ++ Makefile | 11 ++++- docs/shoelaces.8.scd | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 docs/shoelaces.8.scd diff --git a/.gitignore b/.gitignore index 74046b8..be201f7 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,6 @@ _testmain.go shoelaces config.yaml *.deb + +# auto-generated manpage +docs/shoelaces.8 diff --git a/Makefile b/Makefile index 7ce9d40..a831cb3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ GO = go +SCDOC = scdoc + pkgs = $(shell $(GO) list ./... | grep -v /vendor/) all: @@ -8,8 +10,15 @@ fmt: $(GO) fmt clean: - rm -f shoelaces + rm -f shoelaces docs/shoelaces.8 + +shoelaces.8: + $(SCDOC) < docs/shoelaces.8.scd > docs/shoelaces.8 + +docs: shoelaces.8 test: fmt $(GO) test -v $(pkgs) && \ ./test/integ-test/integ_test.py + +.PHONY: all clean docs diff --git a/docs/shoelaces.8.scd b/docs/shoelaces.8.scd new file mode 100644 index 0000000..ec38101 --- /dev/null +++ b/docs/shoelaces.8.scd @@ -0,0 +1,120 @@ +shoelaces(8) + +# NAME + +shoelaces - automated server bootstrapping + +# SYNOPSIS + +*shoelaces* [options...] + +# OPTIONS + +*-config* + Specifies a config file. All the following options can be specified in + the config. + +*-data-dir* + Specifies a directory with mappings, configs, templates, etc. + +*-debug* + Enables debug mode. + +*-domain* + Specifies the address where the server is going to listen. + Defaults to "localhost". + +*-env-dir* + Specifies a directory with environment overrides. Refer to the README of + the project for more information about environment overrides. + +*-mappings-file* + Specifies a mappings YAML file. Defaults to "mappings.yaml". Refer to the + README of the project for more information about mappings. + +*-port* + Specifies the port where the server is going to listen. + Defaults to 8080. + +*-static-dir* + Specifies a custom web directory with static files. Defaults to "web". + +*-template-extension* + Shoelaces template extension. Defaults to ".slc". + +# DESCRIPTION + +Shoelaces serves over HTTP iPXE boot scripts, cloud-init configuration, and +any other configuration files to baremetal or virtual machines booting +using iPXE. It also does a few other things to make easier managing server +deployments: + +- Has a simple but nice UI to show the current configuration, and history + of servers that booted. +- Uses Go templates to handle complex configurations. +- Allows specifying the boot entry point for a given server based on its IP + address or DNS PTR record. +- Supports the notion of environments for Development and Production + environment configurations, while trying to minimize template + duplication. +- Puts unknown servers into iPXE script boot retry loop, while at the same + time showing them in the UI allowing the user to select a specific boot + configuration. + +Shoelaces is better when used along a DHCP server. Refer to the +*CONFIGURATION* section for examples on how to configure a DHCP server for +hooking it with Shoelaces. + +# CONFIGURATION + +Shoelaces searches for a config file whenever the *-config* flag is +specified. + +Here is example config file: + +``` +port=8081 +domain=localhost +data-dir=/etc/shoelaces/data-dir/ +template-extension=.slc +mappings-file=mappings.yaml +debug=true +``` + +*dhcpd*(8) can be hooked with Shoelaces by adding the following snippet in +*dhcpd.conf*(5): + +``` +# dhcp.conf +next-server ; +if exists user-class and option user-class = "iPXE" { + filename "http:///poll/1/${netX/mac:hexhyp}"; +} else { + filename "undionly.kpxe"; +} +``` + +Similarly, *dnsmasq*(8) can be configured for working with Shoelaces with +the following snippet: + +``` +dhcp-match=set:ipxe,175 # iPXE sends a 175 option. +dhcp-boot=tag:!ipxe,undionly.kpxe +dhcp-boot=http:///poll/1/${netX/mac:hexhyp} +``` + +A TFTP server such as *tftpd*(8) must be configured to serve the IPXE ROM, +*undionly.kpxe*. + +# SEE ALSO + +*dhcpd*(8) *dhcpd.conf*(5) *dnsmasq*(8) *tftpd*(8) + +# AUTHORS + +Maintained by ThousandEyes Inc. . + +Up-to-date sources can be found at https://github.com/thousandeyes/shoelaces. + +Bugs reports and patches can be submitted via GitHub's interface or +contacting the maintainers directly via email. -- cgit v1.2.3