From f6248d9ddaf40e438d009ff31e22a53d53f38ab0 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Mon, 20 Feb 2017 17:06:33 -0600 Subject: [PATCH 01/21] smooth over rough edges to make testing and extension easier --- roles/dhcp-server/handlers/main.yml | 1 + roles/dhcp-server/tasks/main.yml | 2 ++ roles/dhcp-server/templates/local.conf.j2 | 3 +++ roles/tftp-server/defaults/main.yml | 2 ++ roles/tftp-server/files/late_command.sh | 22 ++++++++++++++++++++++ roles/tftp-server/tasks/d-i.yml | 2 +- roles/tftp-server/templates/preseed.cfg.j2 | 4 ++-- 7 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 roles/tftp-server/files/late_command.sh diff --git a/roles/dhcp-server/handlers/main.yml b/roles/dhcp-server/handlers/main.yml index 3815964..5ef2e33 100644 --- a/roles/dhcp-server/handlers/main.yml +++ b/roles/dhcp-server/handlers/main.yml @@ -1,6 +1,7 @@ --- - name: restart networking command: "/bin/systemctl restart networking.service" + ignore_errors: yes - name: restart dnsmasq command: "/bin/systemctl restart dnsmasq.service" diff --git a/roles/dhcp-server/tasks/main.yml b/roles/dhcp-server/tasks/main.yml index c0b7dc3..5fe3c04 100644 --- a/roles/dhcp-server/tasks/main.yml +++ b/roles/dhcp-server/tasks/main.yml @@ -17,6 +17,7 @@ dest: /etc/network/interfaces when: use_static_ip notify: restart networking + ignore_errors: yes - name: configure network interfaces (dhcp) template: @@ -24,6 +25,7 @@ dest: /etc/network/interfaces when: not use_static_ip notify: restart networking + ignore_errors: yes - name: ensure network-manager doesn't run its own dnsmasq lineinfile: diff --git a/roles/dhcp-server/templates/local.conf.j2 b/roles/dhcp-server/templates/local.conf.j2 index f18add6..5c19954 100644 --- a/roles/dhcp-server/templates/local.conf.j2 +++ b/roles/dhcp-server/templates/local.conf.j2 @@ -8,3 +8,6 @@ dhcp-boot=pxelinux.0 dhcp-authoritative enable-tftp tftp-root=/srv/tftp +no-hosts +host-record={{ inventory_hostname }},{{ eth_local_ip_address }} + diff --git a/roles/tftp-server/defaults/main.yml b/roles/tftp-server/defaults/main.yml index fcb9ae5..6547ecd 100644 --- a/roles/tftp-server/defaults/main.yml +++ b/roles/tftp-server/defaults/main.yml @@ -8,6 +8,8 @@ apt_proxy: false # Defaults to deb.debian.org | archive.ubuntu.com #mirror: deb.debian.org +web_root: /var/www/html + user_name: videoteam # Defaults to not setting a password #user_password_crypted: changeme diff --git a/roles/tftp-server/files/late_command.sh b/roles/tftp-server/files/late_command.sh new file mode 100644 index 0000000..2a4a080 --- /dev/null +++ b/roles/tftp-server/files/late_command.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +set -euf + +# This script setups ansible and runs it +# It should be ran at the end of the basic installation of a machine + +apt install -y ansible git eatmydata + +# We clone our ansible repository and copy the ansible config files + +git clone https://anonscm.debian.org/git/debconf-video/ansible.git /root/debconf-ansible +git clone https://github.com/xfxf/lca2017-av.git /root/lca2017-av + +ln -s /root/lca2017-av/inventory/ansible-up.sh /usr/local/sbin/ansible-up + +# Aaaand we run ansible +eatmydata ansible-playbook --inventory-file=/root/lca2017-av/inventory/hosts \ + --connection=local \ + --limit=$(hostname) \ + /root/lca2017-av/site.yml \ + /root/debconf-ansible/site.yml diff --git a/roles/tftp-server/tasks/d-i.yml b/roles/tftp-server/tasks/d-i.yml index c63c189..4e76953 100644 --- a/roles/tftp-server/tasks/d-i.yml +++ b/roles/tftp-server/tasks/d-i.yml @@ -23,7 +23,7 @@ dest: "{{ item.path }}" regexp: (\s+append\s+.*\s+initrd=\S+)\s+(?!auto=true)(.*) backrefs: true - line: \1 auto=true interface=auto url={{ inventory_hostname }} \2 + line: \1 auto=true interface=auto url=http://{{ inventory_hostname }} \2 with_items: "{{ menus.files }}" - name: create d-i directory diff --git a/roles/tftp-server/templates/preseed.cfg.j2 b/roles/tftp-server/templates/preseed.cfg.j2 index aa61da2..8b5bde5 100644 --- a/roles/tftp-server/templates/preseed.cfg.j2 +++ b/roles/tftp-server/templates/preseed.cfg.j2 @@ -239,7 +239,7 @@ d-i partman/confirm_nooverwrite boolean true # so this will only work if the disks are the same size. #d-i partman-auto/disk string /dev/sda /dev/sdb -# Next you need to specify the physical partitions that will be used. +# Next you need to specify the physical partitions that will be used. #d-i partman-auto/expert_recipe string \ # multiraid :: \ # 1000 5000 4000 raid \ @@ -335,7 +335,7 @@ d-i apt-setup/local0/key string file:///hd-media/ac583520.asc tasksel tasksel/first multiselect standard # Individual additional packages to install -d-i pkgsel/include string openssh-server curl +d-i pkgsel/include string openssh-server curl python python3 # Whether to upgrade packages after debootstrap. # Allowed values: none, safe-upgrade, full-upgrade #d-i pkgsel/upgrade select none From 0c6df08dcadc35be970d5b5905f8c2560cd2e7df Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Wed, 22 Feb 2017 13:38:55 -0600 Subject: [PATCH 02/21] fix missing space typo --- roles/dhcp-server/templates/local.conf.j2 | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/dhcp-server/templates/local.conf.j2 b/roles/dhcp-server/templates/local.conf.j2 index 5c19954..4d20207 100644 --- a/roles/dhcp-server/templates/local.conf.j2 +++ b/roles/dhcp-server/templates/local.conf.j2 @@ -10,4 +10,3 @@ enable-tftp tftp-root=/srv/tftp no-hosts host-record={{ inventory_hostname }},{{ eth_local_ip_address }} - From 064e19b30bb5aa1228dab9052fff5c68053fa63b Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Fri, 3 Mar 2017 21:12:53 -0600 Subject: [PATCH 03/21] tweak the regex to only catch the first append line in txt.cfg. --- roles/tftp-server/tasks/d-i.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/roles/tftp-server/tasks/d-i.yml b/roles/tftp-server/tasks/d-i.yml index 4e76953..2b43779 100644 --- a/roles/tftp-server/tasks/d-i.yml +++ b/roles/tftp-server/tasks/d-i.yml @@ -21,9 +21,8 @@ - name: inject preseed into menu (do injection) lineinfile: dest: "{{ item.path }}" - regexp: (\s+append\s+.*\s+initrd=\S+)\s+(?!auto=true)(.*) - backrefs: true - line: \1 auto=true interface=auto url=http://{{ inventory_hostname }} \2 + regexp: '\s+append vga=788 initrd=ubuntu-installer/amd64/initrd.gz --- quiet' + line: " append initrd=ubuntu-installer/amd64/initrd.gz auto=true interface=auto url=http://{{ inventory_hostname }} ---" with_items: "{{ menus.files }}" - name: create d-i directory From 7a7757f11daeb639d99843ae948022eb64439cf3 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Mon, 6 Mar 2017 10:50:31 -0600 Subject: [PATCH 04/21] setup preseed for both jessie and xenial (sort of). --- roles/tftp-server/tasks/d-i.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/roles/tftp-server/tasks/d-i.yml b/roles/tftp-server/tasks/d-i.yml index 2b43779..f2fe266 100644 --- a/roles/tftp-server/tasks/d-i.yml +++ b/roles/tftp-server/tasks/d-i.yml @@ -21,20 +21,27 @@ - name: inject preseed into menu (do injection) lineinfile: dest: "{{ item.path }}" - regexp: '\s+append vga=788 initrd=ubuntu-installer/amd64/initrd.gz --- quiet' - line: " append initrd=ubuntu-installer/amd64/initrd.gz auto=true interface=auto url=http://{{ inventory_hostname }} ---" + regexp: (\s+append vga=.*\s+initrd=\S+)\s+(?!auto=true)(.*) + backrefs: true + line: \1 auto=true interface=auto url=http://{{ inventory_hostname }} \2 with_items: "{{ menus.files }}" - name: create d-i directory file: - path: /srv/pxe/d-i/{{ debian_version }} + path: /srv/pxe/d-i/{{ item }} state: directory recurse: true + with_items: + - stretch + - xenial - name: write preseed.cfg template: src: preseed.cfg.j2 - dest: /srv/pxe/d-i/{{ debian_version }}/preseed.cfg + dest: /srv/pxe/d-i/{{ item }}/preseed.cfg + with_items: + - stretch + - xenial - name: generate late_command.sh template: From 9f3f49a033c066a45f621bad1d7952d64b3a37e9 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Mon, 6 Mar 2017 16:21:16 -0600 Subject: [PATCH 05/21] use CarlFK's pending PR repos --- roles/tftp-server/files/late_command.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/tftp-server/files/late_command.sh b/roles/tftp-server/files/late_command.sh index 2a4a080..6ee3de7 100644 --- a/roles/tftp-server/files/late_command.sh +++ b/roles/tftp-server/files/late_command.sh @@ -9,8 +9,10 @@ apt install -y ansible git eatmydata # We clone our ansible repository and copy the ansible config files -git clone https://anonscm.debian.org/git/debconf-video/ansible.git /root/debconf-ansible -git clone https://github.com/xfxf/lca2017-av.git /root/lca2017-av +# git clone https://anonscm.debian.org/git/debconf-video/ansible.git /root/debconf-ansible +git clone https://github.com/CarlFK/video-stack-deploy.git /root/debconf-ansible + +git clone https://github.com/xfxf/av-foss-stack.git /root/lca2017-av ln -s /root/lca2017-av/inventory/ansible-up.sh /usr/local/sbin/ansible-up From cc2550383d7062eb4f772c54ab8fe3713da45f1e Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Mon, 6 Mar 2017 16:22:15 -0600 Subject: [PATCH 06/21] use default protocol (httl) and max the installer debug level --- roles/tftp-server/tasks/d-i.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/tftp-server/tasks/d-i.yml b/roles/tftp-server/tasks/d-i.yml index f2fe266..00ea158 100644 --- a/roles/tftp-server/tasks/d-i.yml +++ b/roles/tftp-server/tasks/d-i.yml @@ -23,7 +23,7 @@ dest: "{{ item.path }}" regexp: (\s+append vga=.*\s+initrd=\S+)\s+(?!auto=true)(.*) backrefs: true - line: \1 auto=true interface=auto url=http://{{ inventory_hostname }} \2 + line: \1 auto=true interface=auto url={{ inventory_hostname }} DEBCONF_DEBUG=5 \2 with_items: "{{ menus.files }}" - name: create d-i directory From 5eae9b18427a0e79ae83739ab43a9983084bfac5 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Tue, 7 Mar 2017 14:01:03 -0600 Subject: [PATCH 07/21] Debian installer constructs FQDN, so resolve it too. --- roles/dhcp-server/templates/local.conf.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/dhcp-server/templates/local.conf.j2 b/roles/dhcp-server/templates/local.conf.j2 index 4d20207..5d7ac4b 100644 --- a/roles/dhcp-server/templates/local.conf.j2 +++ b/roles/dhcp-server/templates/local.conf.j2 @@ -10,3 +10,4 @@ enable-tftp tftp-root=/srv/tftp no-hosts host-record={{ inventory_hostname }},{{ eth_local_ip_address }} +host-record={{ inventory_hostname }}.{{ domain }},{{ eth_local_ip_address }} From 783185ca550ec38fb7edd49fdd22973bbfd93e19 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Tue, 7 Mar 2017 14:04:17 -0600 Subject: [PATCH 08/21] hammer in ansible 2.2, make elegant later. --- roles/tftp-server/files/late_command.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/roles/tftp-server/files/late_command.sh b/roles/tftp-server/files/late_command.sh index 6ee3de7..5538379 100644 --- a/roles/tftp-server/files/late_command.sh +++ b/roles/tftp-server/files/late_command.sh @@ -1,16 +1,23 @@ #!/bin/sh -set -euf +set -eufx # This script setups ansible and runs it # It should be ran at the end of the basic installation of a machine +apt install -y software-properties-common +# apt-add-repository --yes --update "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" +apt-add-repository --yes --update ppa:ansible/ansible + apt install -y ansible git eatmydata # We clone our ansible repository and copy the ansible config files # git clone https://anonscm.debian.org/git/debconf-video/ansible.git /root/debconf-ansible git clone https://github.com/CarlFK/video-stack-deploy.git /root/debconf-ansible +cd /root/debconf-ans +git branch pxe-toucheup +cd - git clone https://github.com/xfxf/av-foss-stack.git /root/lca2017-av From 0e3e70aa2fa3ecfbe8e22d918580eb5bdab405dd Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Tue, 7 Mar 2017 14:27:40 -0600 Subject: [PATCH 09/21] Fix line-oh. --- roles/tftp-server/files/late_command.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/tftp-server/files/late_command.sh b/roles/tftp-server/files/late_command.sh index 5538379..044429e 100644 --- a/roles/tftp-server/files/late_command.sh +++ b/roles/tftp-server/files/late_command.sh @@ -15,7 +15,7 @@ apt install -y ansible git eatmydata # git clone https://anonscm.debian.org/git/debconf-video/ansible.git /root/debconf-ansible git clone https://github.com/CarlFK/video-stack-deploy.git /root/debconf-ansible -cd /root/debconf-ans +cd /root/debconf-ansible git branch pxe-toucheup cd - From 8c64cc735ae6405b8424a8bbd86834eadfddec11 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Thu, 9 Mar 2017 01:14:39 -0600 Subject: [PATCH 10/21] use correct git command to checkout a branch. --- roles/tftp-server/files/late_command.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/tftp-server/files/late_command.sh b/roles/tftp-server/files/late_command.sh index 044429e..226c363 100644 --- a/roles/tftp-server/files/late_command.sh +++ b/roles/tftp-server/files/late_command.sh @@ -16,7 +16,7 @@ apt install -y ansible git eatmydata # git clone https://anonscm.debian.org/git/debconf-video/ansible.git /root/debconf-ansible git clone https://github.com/CarlFK/video-stack-deploy.git /root/debconf-ansible cd /root/debconf-ansible -git branch pxe-toucheup +git checkout pxe-toucheup cd - git clone https://github.com/xfxf/av-foss-stack.git /root/lca2017-av From d4a102b8b41486ddc4daa92dcc0e5825732c271d Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Thu, 9 Mar 2017 16:47:44 -0600 Subject: [PATCH 11/21] only test dc roles --- roles/tftp-server/files/late_command.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/tftp-server/files/late_command.sh b/roles/tftp-server/files/late_command.sh index 226c363..f0ee353 100644 --- a/roles/tftp-server/files/late_command.sh +++ b/roles/tftp-server/files/late_command.sh @@ -24,8 +24,8 @@ git clone https://github.com/xfxf/av-foss-stack.git /root/lca2017-av ln -s /root/lca2017-av/inventory/ansible-up.sh /usr/local/sbin/ansible-up # Aaaand we run ansible -eatmydata ansible-playbook --inventory-file=/root/lca2017-av/inventory/hosts \ +eatmydata ansible-playbook \ --connection=local \ --limit=$(hostname) \ - /root/lca2017-av/site.yml \ + --inventory-file=/root/lca2017-av/inventory/hosts \ /root/debconf-ansible/site.yml From f9671dca01612ea2b1afbd689eb217e960fc0642 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Fri, 10 Mar 2017 12:02:05 -0600 Subject: [PATCH 12/21] move disk=hda to boot params for on the fly adjustment. --- roles/tftp-server/tasks/d-i.yml | 2 +- roles/tftp-server/templates/preseed.cfg.j2 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/tftp-server/tasks/d-i.yml b/roles/tftp-server/tasks/d-i.yml index 00ea158..421d087 100644 --- a/roles/tftp-server/tasks/d-i.yml +++ b/roles/tftp-server/tasks/d-i.yml @@ -23,7 +23,7 @@ dest: "{{ item.path }}" regexp: (\s+append vga=.*\s+initrd=\S+)\s+(?!auto=true)(.*) backrefs: true - line: \1 auto=true interface=auto url={{ inventory_hostname }} DEBCONF_DEBUG=5 \2 + line: \1 auto=true interface=auto url={{ inventory_hostname }} DEBCONF_DEBUG=5 partman-auto/disk="/dev/hda" \2 with_items: "{{ menus.files }}" - name: create d-i directory diff --git a/roles/tftp-server/templates/preseed.cfg.j2 b/roles/tftp-server/templates/preseed.cfg.j2 index 8b5bde5..42e7c5a 100644 --- a/roles/tftp-server/templates/preseed.cfg.j2 +++ b/roles/tftp-server/templates/preseed.cfg.j2 @@ -165,7 +165,7 @@ d-i clock-setup/ntp boolean true # name must be given in traditional, non-devfs format (so e.g. /dev/hda or # /dev/sda, and not e.g. /dev/discs/disc0/disc). # For example, to use the first SCSI/SATA hard disk: -d-i partman-auto/disk string /dev/sda +# d-i partman-auto/disk string /dev/sda # In addition, you'll need to specify the method to use. # The presently available methods are: # - regular: use the usual partition types for your architecture @@ -365,9 +365,9 @@ d-i grub-installer/with_other_os boolean true # Due notably to potential USB sticks, the location of the MBR can not be # determined safely in general, so this needs to be specified: -d-i grub-installer/bootdev string /dev/sda +# d-i grub-installer/bootdev string /dev/sda # To install to the first device (assuming it is not a USB stick): -#d-i grub-installer/bootdev string default +d-i grub-installer/bootdev string default # Alternatively, if you want to install to a location other than the mbr, # uncomment and edit these lines: From 6ef063b4203c9bd48b798a869e4163d4bce27207 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Fri, 10 Mar 2017 14:05:05 -0600 Subject: [PATCH 13/21] sda is a better default than hda. --- roles/tftp-server/tasks/d-i.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/tftp-server/tasks/d-i.yml b/roles/tftp-server/tasks/d-i.yml index 421d087..eefc81f 100644 --- a/roles/tftp-server/tasks/d-i.yml +++ b/roles/tftp-server/tasks/d-i.yml @@ -23,7 +23,7 @@ dest: "{{ item.path }}" regexp: (\s+append vga=.*\s+initrd=\S+)\s+(?!auto=true)(.*) backrefs: true - line: \1 auto=true interface=auto url={{ inventory_hostname }} DEBCONF_DEBUG=5 partman-auto/disk="/dev/hda" \2 + line: \1 auto=true interface=auto url={{ inventory_hostname }} DEBCONF_DEBUG=5 partman-auto/disk="/dev/sda" \2 with_items: "{{ menus.files }}" - name: create d-i directory From 3275ffa7ebe25a5b21d27cf69f73cbc6ad384a25 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Fri, 10 Mar 2017 16:55:17 -0600 Subject: [PATCH 14/21] grub-ipxe makes testing pxe easier --- roles/tftp-server/templates/preseed.cfg.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/tftp-server/templates/preseed.cfg.j2 b/roles/tftp-server/templates/preseed.cfg.j2 index 42e7c5a..86db6ee 100644 --- a/roles/tftp-server/templates/preseed.cfg.j2 +++ b/roles/tftp-server/templates/preseed.cfg.j2 @@ -335,7 +335,7 @@ d-i apt-setup/local0/key string file:///hd-media/ac583520.asc tasksel tasksel/first multiselect standard # Individual additional packages to install -d-i pkgsel/include string openssh-server curl python python3 +d-i pkgsel/include string openssh-server curl python python3 grub-ipxe # Whether to upgrade packages after debootstrap. # Allowed values: none, safe-upgrade, full-upgrade #d-i pkgsel/upgrade select none From fc635af1d6fcd7b5e555d65f2fd8e064ed0cf44c Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Sat, 8 Apr 2017 20:16:35 -0500 Subject: [PATCH 15/21] chagne ansible_distribution to distro so that a Ubuntu box can install debian nodes --- roles/tftp-server/templates/preseed.cfg.j2 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/tftp-server/templates/preseed.cfg.j2 b/roles/tftp-server/templates/preseed.cfg.j2 index 86db6ee..fb77e09 100644 --- a/roles/tftp-server/templates/preseed.cfg.j2 +++ b/roles/tftp-server/templates/preseed.cfg.j2 @@ -12,9 +12,9 @@ d-i debian-installer/locale string en_US #d-i localechooser/supported-locales multiselect en_US.UTF-8, nl_NL.UTF-8 # Keyboard selection. -{% if ansible_distribution == 'Debian' %} +{% if distro == 'Debian' %} d-i keyboard-configuration/xkb-keymap select us -{% elif ansible_distribution == 'Ubuntu' %} +{% elif distro == 'Ubuntu' %} d-i keyboard-configuration/layoutcode string us {% endif %} # d-i keyboard-configuration/toggle select No toggling @@ -102,10 +102,10 @@ d-i netcfg/wireless_wep string # If you select ftp, the mirror/country string does not need to be set. #d-i mirror/protocol string ftp d-i mirror/country string manual -{% if ansible_distribution == 'Debian' %} +{% if distro == 'Debian' %} d-i mirror/http/hostname string {{ mirror | default('deb.debian.org') }} d-i mirror/http/directory string /debian -{% elif ansible_distribution == 'Ubuntu' %} +{% elif distro == 'Ubuntu' %} d-i mirror/http/hostname string {{ mirror | default('archive.ubuntu.com') }} d-i mirror/http/directory string /ubuntu {% endif %} @@ -132,7 +132,7 @@ d-i passwd/username string {{ user_name }} {% if user_password_crypted is defined %} d-i passwd/user-password-crypted password {{ user_password_crypted }} {% endif %} -{% if ansible_distribution == 'Ubuntu' %} +{% if distro == 'Ubuntu' %} # Ubuntu offers encrypted home directories d-i user-setup/encrypt-home boolean false {% endif %} @@ -183,7 +183,7 @@ 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 ansible_distribution == 'Ubuntu' %} +{% if distro == 'Ubuntu' %} # Use all the space on LVM d-i partman-auto-lvm/guided_size string max {% endif %} @@ -309,7 +309,7 @@ d-i apt-setup/contrib boolean true #d-i apt-setup/services-select multiselect security, updates #d-i apt-setup/security_host string security.debian.org -{% if ansible_distribution == 'Ubuntu' %} +{% if distro == 'Ubuntu' %} d-i pkgsel/update-policy string unattended-upgrades {% endif %} From 157e33c937e1a2ae3aefc717251cd05c54e87b6c Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Tue, 11 Apr 2017 03:01:45 -0500 Subject: [PATCH 16/21] stretch not jessie --- roles/system-software/handlers/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/system-software/handlers/main.yml b/roles/system-software/handlers/main.yml index 0b80e1e..c5ae447 100644 --- a/roles/system-software/handlers/main.yml +++ b/roles/system-software/handlers/main.yml @@ -1,3 +1,4 @@ --- - name: restart systemd-journald command: systemctl restart systemd-journald + when: ansible_env.ANSIBLE_UNDER_DI is undefined From 42025c62a8593179fc4a4406657af8f4e7a40650 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Thu, 13 Apr 2017 12:12:55 -0500 Subject: [PATCH 17/21] ansible in main repos is 2.2.x, that's good. --- roles/tftp-server/files/late_command.sh | 4 ++-- roles/tftp-server/templates/preseed.cfg.j2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/tftp-server/files/late_command.sh b/roles/tftp-server/files/late_command.sh index f0ee353..aa8bc4f 100644 --- a/roles/tftp-server/files/late_command.sh +++ b/roles/tftp-server/files/late_command.sh @@ -5,9 +5,9 @@ set -eufx # This script setups ansible and runs it # It should be ran at the end of the basic installation of a machine -apt install -y software-properties-common +# apt install -y software-properties-common # apt-add-repository --yes --update "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" -apt-add-repository --yes --update ppa:ansible/ansible +# apt-add-repository --yes --update ppa:ansible/ansible apt install -y ansible git eatmydata diff --git a/roles/tftp-server/templates/preseed.cfg.j2 b/roles/tftp-server/templates/preseed.cfg.j2 index fb77e09..0b8fef4 100644 --- a/roles/tftp-server/templates/preseed.cfg.j2 +++ b/roles/tftp-server/templates/preseed.cfg.j2 @@ -335,7 +335,7 @@ d-i apt-setup/local0/key string file:///hd-media/ac583520.asc tasksel tasksel/first multiselect standard # Individual additional packages to install -d-i pkgsel/include string openssh-server curl python python3 grub-ipxe +d-i pkgsel/include string openssh-server curl python python3 # grub-ipxe # Whether to upgrade packages after debootstrap. # Allowed values: none, safe-upgrade, full-upgrade #d-i pkgsel/upgrade select none From f018e674e14e8bfabc056a59c35479a6480a8e82 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Fri, 14 Apr 2017 01:22:59 -0500 Subject: [PATCH 18/21] Add dupport for minicom --- roles/tftp-server/templates/preseed.cfg.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/tftp-server/templates/preseed.cfg.j2 b/roles/tftp-server/templates/preseed.cfg.j2 index 0b8fef4..3f851df 100644 --- a/roles/tftp-server/templates/preseed.cfg.j2 +++ b/roles/tftp-server/templates/preseed.cfg.j2 @@ -428,7 +428,8 @@ d-i finish-install/reboot_in_progress note # This first command is run as early as possible, just after # preseeding is read. -#d-i preseed/early_command string anna-install some-udeb +d-i preseed/early_command string cd /tmp && wget http://$url/ec/early_command.sh && chmod u+x early_command.sh && ./early_command.sh + # This command is run immediately before the partitioner starts. It may be # useful to apply dynamic partitioner preseeding that depends on the state # of the disks (which may not be visible when preseed/early_command runs). From a5d09fecf41b2627b261feb8c87e1ee6615e322a Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Fri, 14 Apr 2017 23:12:00 -0500 Subject: [PATCH 19/21] run preseed so we cna see stdout. --- roles/tftp-server/templates/preseed.cfg.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/tftp-server/templates/preseed.cfg.j2 b/roles/tftp-server/templates/preseed.cfg.j2 index 3f851df..f964709 100644 --- a/roles/tftp-server/templates/preseed.cfg.j2 +++ b/roles/tftp-server/templates/preseed.cfg.j2 @@ -439,7 +439,7 @@ d-i preseed/early_command string cd /tmp && wget http://$url/ec/early_command.sh # still a usable /target directory. You can chroot to /target and use it # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. -d-i preseed/late_command string in-target sh -c "curl -o late_command.sh 'http://{{ inventory_hostname }}/d-i/late_command.sh' && ANSIBLE_UNDER_DI=1 sh late_command.sh && rm late_command.sh" +d-i preseed/late_command string cd /target/tmp && wget http://$url/d-i/late_command.sh && chmod u+x late_command.sh && chroot /target unset http_proxy; ANSIBLE_UNDER_DI=1 /tmp/late_command.sh $(debconf-get mirror/suite) $(debconf-get passwd/username) # don't ask for extra firmare d-i hw-detect/load_firmware boolean false From c54c339050dca56e65d597dd79afbd47d2116771 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Mon, 17 Apr 2017 21:22:06 -0500 Subject: [PATCH 20/21] moved things to be easeir to read --- roles/tftp-server/files/late_command.sh | 9 ++++++++- roles/tftp-server/templates/preseed.cfg.j2 | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/roles/tftp-server/files/late_command.sh b/roles/tftp-server/files/late_command.sh index aa8bc4f..f934cee 100644 --- a/roles/tftp-server/files/late_command.sh +++ b/roles/tftp-server/files/late_command.sh @@ -23,9 +23,16 @@ git clone https://github.com/xfxf/av-foss-stack.git /root/lca2017-av ln -s /root/lca2017-av/inventory/ansible-up.sh /usr/local/sbin/ansible-up +# not sure why sometimes this is only needed when I run from a prompt in the installer shell, +# but the istaller doesn't. or something. I'm not sure when it is needed. +mkdir /dev/shm +echo "none /dev/shm tmpfs rw,nosuid,nodev,noexec,noauto 0 0" >> /etc/fstab +mount /dev/shm + # Aaaand we run ansible eatmydata ansible-playbook \ + -vvvv \ --connection=local \ - --limit=$(hostname) \ + --limit=$(hostname) \ --inventory-file=/root/lca2017-av/inventory/hosts \ /root/debconf-ansible/site.yml diff --git a/roles/tftp-server/templates/preseed.cfg.j2 b/roles/tftp-server/templates/preseed.cfg.j2 index f964709..ca5a734 100644 --- a/roles/tftp-server/templates/preseed.cfg.j2 +++ b/roles/tftp-server/templates/preseed.cfg.j2 @@ -309,10 +309,6 @@ d-i apt-setup/contrib boolean true #d-i apt-setup/services-select multiselect security, updates #d-i apt-setup/security_host string security.debian.org -{% if distro == 'Ubuntu' %} -d-i pkgsel/update-policy string unattended-upgrades -{% endif %} - # Additional repositories, local[0-9] available #d-i apt-setup/local0/repository string \ # http://local.server/debian stable main @@ -340,6 +336,10 @@ d-i pkgsel/include string openssh-server curl python python3 # grub-ipxe # Allowed values: none, safe-upgrade, full-upgrade #d-i pkgsel/upgrade select none +{% if distro == 'Ubuntu' %} +d-i pkgsel/update-policy string unattended-upgrades +{% endif %} + # Some versions of the installer can report back on what software you have # installed, and what software you use. The default is not to report back, # but sending reports helps the project determine what software is most From fd59a81482c91327f865e25f44aee7d467bf7015 Mon Sep 17 00:00:00 2001 From: Carl Karsten Date: Thu, 15 Jun 2017 14:23:48 -0500 Subject: [PATCH 21/21] default and document distro var --- roles/tftp-server/defaults/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/tftp-server/defaults/main.yml b/roles/tftp-server/defaults/main.yml index 6547ecd..252f8a9 100644 --- a/roles/tftp-server/defaults/main.yml +++ b/roles/tftp-server/defaults/main.yml @@ -21,3 +21,7 @@ playbook_branch: master # To replace the stock inventory with your own, point at your own github repo #inventory_repo: https://gitlab.com/yourname/ansible-inventory #inventory_branch: master + +# What Distro to install? +# Debian or Ubuntu +distro: Debian