Adds in TFTP Configure role - Ubuntu 16.04

Building on from the previous commit https://review.openstack.org/427869
this adds in TFTP configure role which handles all the pre-seed
templates and sets up all the PXEBoot files.

Change-Id: Ibdf7bfac9bc2c5b5cabdc79ce8584112b2ae0678
This commit is contained in:
Rick Box 2017-02-03 04:19:39 +00:00
parent 088d941d22
commit f8fef621cb
16 changed files with 1883 additions and 0 deletions

View File

@ -0,0 +1,28 @@
tftpboot_configure
=========
This module configures custom tftp allowing for netboot of an Ubuntu system. It dynamically creates a TFTBoot based on the MAC addresses passed in. It also generates a preseed and late command which are used to install the system
Requirements
------------
This module requires Ansible 2.x
Role Variables
--------------
See defaults for variables and descriptions
Dependencies
------------
This role depends on a DHCPD and ATFTP roles
Example Playbook
----------------
Example to call:
- hosts: all
roles:
- { role: tftpboot_configure }

View File

@ -0,0 +1,48 @@
---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# name: tftpboot_configure/defaults
# description: ALL our default variables for tftpboot_configure go in here
#------------------------------------------------------------------------------
# Packages - All our required packages we need installing
#------------------------------------------------------------------------------
# - variables -
tftp_mirror: archive.ubuntu.com # Where will we pull our linux boot environment from
tftp_proxy: blank # What proxy will we use, if any.
tftp_distro: [ xenial ] # What distribution will we pull
tftp_files: [ initrd.gz, linux ]
ntp_server: pool.ntp.org
atftpd_path: /srv/tftp # What is the path for our tftpd
tftp_source: /srv/tftp_source/ # What is the path where the source pxe config files are placed per server
atftp_user: nobody # What user does this environment get set up as
atftp_group: nogroup # What group does this environment get set up as
preseed_password: hackme # Default password placed into pre-seed file
vm_disk_device: vda # Default disk device used in pre-seed
vm_net_iface: ens3 # Default interface used in pre-seed
ssh_key: blank
# These below variables rely on apache being set up and is where the preseed is set up
preseed_apache_url: pxe # What is the url http://server/THISVARHERE
preseed_path: /var/www/pxe # What path
webserver_ip_address: "{{ ansible_default_ipv4.address }}"
server_list: # What is our list of servers
- name: blank
hwaddr: "aa:aa:aa:aa:aa:aa"
distro: xenial
preseed_file: my-preseed-file # Allow a custom preseed on a per server basis

View File

@ -0,0 +1,22 @@
---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
galaxy_info:
author: "Rick Box - BBC R&D"
license: Apache2
min_ansible_version: 2.0
platforms:
- name: Ubuntu
versions:
- xenial
dependencies: []

View File

@ -0,0 +1,101 @@
---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# module: tftpboot_configure/tasks/configure
# description: Configure tftpboot_configure
- name: Create pxeboot directories
file:
path: "{{ atftpd_path }}/{{ item }}"
state: directory
owner: "{{ atftp_user }}"
group: "{{ atftp_group }}"
with_items:
- images
- pxelinux.cfg
- name: Create pxeboot directories for distributions
file:
path: "{{ atftpd_path }}/images/{{ item }}/"
state: directory
owner: "{{ atftp_user }}"
group: "{{ atftp_group }}"
with_items: "{{ tftp_distro }}"
- name: Create apache directories for preseed
file:
path: "{{ preseed_path }}"
state: directory
- name: Create the preseed files
template:
src: "{{ item.preseed_file }}.j2"
dest: "{{ preseed_path }}/{{ item.preseed_file }}"
with_items: "{{ server_list }}"
- name: Pull down boot kernel and initrd - create download directory -{{ tftp_distro }}-
file:
path: "/var/lib/netboot/{{ item }}"
mode: 0644
state: directory
owner: "{{ atftp_user }}"
group: "{{ atftp_group }}"
with_items: "{{ tftp_distro }}"
- name: Pull down boot kernel and initrd - download -"{{ tftp_distro }}"- releases -"{{ tftp_files }}"- files and place in /var/lib/netboot/
get_url:
url: "http://{{ tftp_mirror }}/ubuntu/dists/{{ item[0] }}-updates/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/{{ item[1] }}"
dest: /var/lib/netboot/{{ item[0] }}
mode: 0644
owner: "{{ atftp_user }}"
group: "{{ atftp_group }}"
with_nested:
- "{{ tftp_distro }}"
- "{{ tftp_files }}"
- name: Create hard link to our boot images in the distribution folder
file:
src: "/var/lib/netboot/{{ item[0] }}/{{ item[1] }}"
dest: "{{ atftpd_path }}/images/{{ item[0] }}/{{ item[1] }}"
state: hard
with_nested:
- "{{ tftp_distro }}"
- "{{ tftp_files }}"
- name: Copy pxe boot files
copy:
src: "{{ item }}"
dest: "{{ atftpd_path }}"
owner: "{{ atftp_user }}"
group: "{{ atftp_group }}"
with_items:
- memdisk
- menu.c32
- pxelinux.0
- name: Create a template for each of our defined servers
template:
src: pxelinux.j2
dest: "{{ tftp_source }}/01-{{ item.hwaddr | regex_replace(':', '-') }}"
owner: "{{ atftp_user }}"
group: "{{ atftp_group }}"
follow: yes
with_items: "{{ server_list }}"
when: item.distro is defined
- name: Create our default template for menu
template:
src: default_pxelinux.j2
dest: "{{ atftpd_path }}/pxelinux.cfg/default"
owner: "{{ atftp_user }}"
group: "{{ atftp_group }}"

View File

@ -0,0 +1,17 @@
---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# module: tftpboot_configure/tasks
# description: Install tftpboot_configure onto an Ubuntu 16.xx server
- include: configure.yml

View File

@ -0,0 +1,19 @@
DEFAULT menu
PROMPT 0
MENU TITLE PXEBoot
TIMEOUT 3
TOTALTIMEOUT 6000
ONTIMEOUT local
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
LABEL xenial
kernel /images/xenial/linux
MENU LABEL xenial
append initrd=/images/xenial/initrd.gz ksdevice=bootif netcfg/choose_interface=auto text auto-install/enable=true priority=critical url=http://{{ webserver_ip_address }}/{{ preseed_apache_url }}/xenial hostname=xenial domain=local.lan suite=xenial
ipappend 2
MENU end

View File

@ -0,0 +1,8 @@
default linux
prompt 0
timeout 1
label linux
kernel /images/{{ item.distro }}/linux
ipappend 2
append initrd=/images/{{ item.distro }}/initrd.gz ksdevice=bootif netcfg/choose_interface=auto text auto-install/enable=true priority=critical url=http://{{ webserver_ip_address }}/{{ preseed_apache_url }}/{{ item.preseed_file }} hostname={{ item.name }} domain=local.lan suite={{ item.distro }}

View File

@ -0,0 +1,273 @@
#
# Ubuntu Server 16.04 Preseed
#
# Usage:
#
# This Ubuntu Preseed file is a completely unattended install.
#
# References:
#
# https://help.ubuntu.com/16.04/installation-guide/example-preseed.txt
# http://www.claudiokuenzler.com/blog/513/debian-ubuntu-preseed-create-two-volume-groups-same-disk
#############
#
# Kernel Options
#
#############
# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
# d-i debian-installer/add-kernel-opts string $kernel_options_post
#############
#
# Networking
#
#############
d-i netcfg/choose_interface select {{ vm_net_iface }}
d-i netcfg/dhcp_timeout string 60
#d-i netcfg/disable_autoconfig boolean true
#d-i netcfg/dhcp_failed note
#d-i netcfg/dhcp_options select Configure network manually
# Static network configuration.
#d-i netcfg/get_ipaddress string 192.168.0.1
#d-i netcfg/get_netmask string 255.255.255.0
#d-i netcfg/get_gateway string 192.168.0.2
#d-i netcfg/get_nameservers string 8.8.8.8
#d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string cinder_node
d-i netcfg/get_domain string openstackci.local
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
#############
#
# Pre Install
#
#############
# Command Line 1: This is necessary otherwise you will be prompted to umount /dev/{{ vm_disk_device }}. See Ubuntu bug #1347726.
d-i preseed/early_command string \
umount /media || true
#############
#
# Localization
#
#############
d-i debian-installer/locale string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/language string en
#############
#
# Keyboard
#
#############
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i console-setup/variantcode string
d-i keyboard-configuration/layoutcode string us
#############
#
# Mirror
#
#############
d-i mirror/country string manual
{% if tftp_proxy != 'blank' %}
d-i mirror/http/proxy string {{ tftp_proxy }}
{% endif %}
d-i mirror/http/hostname string {{ tftp_mirror }}
d-i mirror/http/directory string /ubuntu
#############
#
# Clock and Time Zone
#
#############
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string {{ ntp_server }}
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Central
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
#############
#
# Partitioning
#
#############
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/method string lvm
d-i partman-auto/disk string /dev/{{ vm_disk_device }}
# For LVM partitioning, you can select how much of the volume group to use
# for logical volumes.
d-i partman-auto-lvm/guided_size string max
# This is used to auto-confirm its OK to use a partition without an FS
d-i partman-basicmethods/method_only boolean false
d-i partman-auto/choose_recipe select custompartitioning
d-i partman-auto/expert_recipe string \
custompartitioning :: \
512 1 512 ext2 \
$primary{ } \
$bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
label{ boot } \
mountpoint{ /boot } \
. \
1024 1 100% ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/{{ vm_disk_device }}2 } \
vg_name{ lxc } \
. \
8192 1 8192 linux-swap \
$lvmok{ } in_vg{ lxc } \
lv_name{ swap00 } \
method{ swap } format{ } \
. \
51200 1 51200 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ root00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ root } \
mountpoint{ / } \
. \
76800 1 76800 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ openstack00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ openstack00 } \
mountpoint{ /openstack } \
. \
1024 1 1000000000 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ cinder00 } \
method{ keep } \
. \
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
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
#############
#
# Packages
#
#############
# Package selection
tasksel tasksel/first multiselect openssh-server
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
d-i pkgsel/upgrade select none
d-i pkgsel/include string bridge-utils ethtool ifenslave lvm2 openssh-server python2.7 vim vlan python-simplejson
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# 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
# popular and include it on CDs.
popularity-contest popularity-contest/participate boolean false
#############
#
# Users and Password
#
#############
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
d-i passwd/root-login boolean true
# Alternatively, to skip creation of a normal user account.
d-i passwd/make-user boolean false
# The installer will warn about weak passwords. If you are sure you know
# what you're doing and want to override it, uncomment this.
d-i user-setup/allow-password-weak boolean true
# Root password, either in clear text
d-i passwd/root-password password {{ preseed_password }}
d-i passwd/root-password-again password {{ preseed_password }}
#############
#
# Bootloader
#
#############
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
#############
#
# Post Install
#
#############
d-i preseed/late_command string \
wget --no-proxy http://{{ webserver_ip_address }}/files/xenial-sources.list -O /target/etc/apt/sources.list; \
wget --no-proxy http://{{ webserver_ip_address }}/files/osa-$hostname-bridges.cfg -O /target/etc/network/interfaces.d/osa-$hostname-bridges.cfg; \
sed -i '/PermitRootLogin / s/ .*/ yes/' /target/etc/ssh/sshd_config; \
mkdir /target/root/.ssh; \
chmod 0700 /target/root/.ssh; \
echo "{{ ssh_key }}" >> /target/root/.ssh/authorized_keys; \
vgcreate cinder-volumes /dev/mapper/lxc-cinder00; \
killall.sh || true; \
netcfg; \
echo -e '#!/bin/sh\n\nif ! grep -q "^source.*cfg$" /etc/network/interfaces; then echo "source /etc/network/interfaces.d/*.cfg" >> /etc/network/interfaces; fi' > /target/etc/network/if-pre-up.d/multi-nic; \
chmod +x /target/etc/network/if-pre-up.d/multi-nic
#############
#
# Finish
#
#############
# Reboot after the install is finished.
finish-install finish-install/reboot_in_progress note

View File

@ -0,0 +1,267 @@
#
# Ubuntu Server 16.04 Preseed
#
# Usage:
#
# This Ubuntu Preseed file is a completely unattended install.
#
# References:
#
# https://help.ubuntu.com/16.04/installation-guide/example-preseed.txt
# http://www.claudiokuenzler.com/blog/513/debian-ubuntu-preseed-create-two-volume-groups-same-disk
#############
#
# Kernel Options
#
#############
# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
# d-i debian-installer/add-kernel-opts string $kernel_options_post
#############
#
# Networking
#
#############
d-i netcfg/choose_interface select {{ vm_net_iface }}
d-i netcfg/dhcp_timeout string 60
#d-i netcfg/disable_autoconfig boolean true
#d-i netcfg/dhcp_failed note
#d-i netcfg/dhcp_options select Configure network manually
# Static network configuration.
#d-i netcfg/get_ipaddress string 192.168.0.1
#d-i netcfg/get_netmask string 255.255.255.0
#d-i netcfg/get_gateway string 192.168.0.2
#d-i netcfg/get_nameservers string 8.8.8.8
#d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string infra_node
d-i netcfg/get_domain string openstackci.local
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
#############
#
# Pre Install
#
#############
# Command Line 1: This is necessary otherwise you will be prompted to umount /dev/{{ vm_disk_device }}. See Ubuntu bug #1347726.
d-i preseed/early_command string \
umount /media || true
#############
#
# Localization
#
#############
d-i debian-installer/locale string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/language string en
#############
#
# Keyboard
#
#############
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i console-setup/variantcode string
d-i keyboard-configuration/layoutcode string us
#############
#
# Mirror
#
#############
d-i mirror/country string manual
{% if tftp_proxy != 'blank' %}
d-i mirror/http/proxy string {{ tftp_proxy }}
{% endif %}
d-i mirror/http/hostname string {{ tftp_mirror }}
d-i mirror/http/directory string /ubuntu
#############
#
# Clock and Time Zone
#
#############
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string {{ ntp_server }}
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Central
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
#############
#
# Partitioning
#
#############
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/method string lvm
d-i partman-auto/disk string /dev/{{ vm_disk_device }}
# For LVM partitioning, you can select how much of the volume group to use
# for logical volumes.
d-i partman-auto-lvm/guided_size string max
# This is used to auto-confirm its OK to use a partition without an FS
d-i partman-basicmethods/method_only boolean false
d-i partman-auto/choose_recipe select custompartitioning
d-i partman-auto/expert_recipe string \
custompartitioning :: \
512 1 512 ext2 \
$primary{ } \
$bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
label{ boot } \
mountpoint{ /boot } \
. \
1024 1 100% ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/{{ vm_disk_device }}2 } \
vg_name{ lxc } \
. \
8192 1 8192 linux-swap \
$lvmok{ } in_vg{ lxc } \
lv_name{ swap00 } \
method{ swap } format{ } \
. \
153600 1 153600 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ openstack00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ openstack00 } \
mountpoint{ /openstack } \
. \
1024 1 1000000000 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ root00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ root } \
mountpoint{ / } \
. \
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
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
#############
#
# Packages
#
#############
# Package selection
tasksel tasksel/first multiselect openssh-server
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
d-i pkgsel/upgrade select none
d-i pkgsel/include string bridge-utils ethtool ifenslave lvm2 openssh-server python2.7 vim vlan python-simplejson
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# 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
# popular and include it on CDs.
popularity-contest popularity-contest/participate boolean false
#############
#
# Users and Password
#
#############
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
d-i passwd/root-login boolean true
# Alternatively, to skip creation of a normal user account.
d-i passwd/make-user boolean false
# The installer will warn about weak passwords. If you are sure you know
# what you're doing and want to override it, uncomment this.
d-i user-setup/allow-password-weak boolean true
# Root password, either in clear text
d-i passwd/root-password password {{ preseed_password }}
d-i passwd/root-password-again password {{ preseed_password }}
#############
#
# Bootloader
#
#############
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
#############
#
# Post Install
#
#############
d-i preseed/late_command string \
wget --no-proxy http://{{ webserver_ip_address }}/files/xenial-sources.list -O /target/etc/apt/sources.list; \
wget --no-proxy http://{{ webserver_ip_address }}/files/osa-$hostname-bridges.cfg -O /target/etc/network/interfaces.d/osa-$hostname-bridges.cfg; \
sed -i '/PermitRootLogin / s/ .*/ yes/' /target/etc/ssh/sshd_config; \
mkdir /target/root/.ssh; \
chmod 0700 /target/root/.ssh; \
echo "{{ ssh_key }}" >> /target/root/.ssh/authorized_keys; \
killall.sh || true; \
netcfg; \
echo -e '#!/bin/sh\n\nif ! grep -q "^source.*cfg$" /etc/network/interfaces; then echo "source /etc/network/interfaces.d/*.cfg" >> /etc/network/interfaces; fi' > /target/etc/network/if-pre-up.d/multi-nic; \
chmod +x /target/etc/network/if-pre-up.d/multi-nic
#############
#
# Finish
#
#############
# Reboot after the install is finished.
finish-install finish-install/reboot_in_progress note

View File

@ -0,0 +1,267 @@
#
# Ubuntu Server 16.04 Preseed
#
# Usage:
#
# This Ubuntu Preseed file is a completely unattended install.
#
# References:
#
# https://help.ubuntu.com/16.04/installation-guide/example-preseed.txt
# http://www.claudiokuenzler.com/blog/513/debian-ubuntu-preseed-create-two-volume-groups-same-disk
#############
#
# Kernel Options
#
#############
# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
# d-i debian-installer/add-kernel-opts string $kernel_options_post
#############
#
# Networking
#
#############
d-i netcfg/choose_interface select {{ vm_net_iface }}
d-i netcfg/dhcp_timeout string 60
#d-i netcfg/disable_autoconfig boolean true
#d-i netcfg/dhcp_failed note
#d-i netcfg/dhcp_options select Configure network manually
# Static network configuration.
#d-i netcfg/get_ipaddress string 192.168.0.1
#d-i netcfg/get_netmask string 255.255.255.0
#d-i netcfg/get_gateway string 192.168.0.2
#d-i netcfg/get_nameservers string 8.8.8.8
#d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string logging_node
d-i netcfg/get_domain string openstackci.local
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
#############
#
# Pre Install
#
#############
# Command Line 1: This is necessary otherwise you will be prompted to umount /dev/{{ vm_disk_device }}. See Ubuntu bug #1347726.
d-i preseed/early_command string \
umount /media || true
#############
#
# Localization
#
#############
d-i debian-installer/locale string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/language string en
#############
#
# Keyboard
#
#############
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i console-setup/variantcode string
d-i keyboard-configuration/layoutcode string us
#############
#
# Mirror
#
#############
d-i mirror/country string manual
{% if tftp_proxy != 'blank' %}
d-i mirror/http/proxy string {{ tftp_proxy }}
{% endif %}
d-i mirror/http/hostname string {{ tftp_mirror }}
d-i mirror/http/directory string /ubuntu
#############
#
# Clock and Time Zone
#
#############
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string {{ ntp_server }}
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Central
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
#############
#
# Partitioning
#
#############
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/method string lvm
d-i partman-auto/disk string /dev/{{ vm_disk_device }}
# For LVM partitioning, you can select how much of the volume group to use
# for logical volumes.
d-i partman-auto-lvm/guided_size string max
# This is used to auto-confirm its OK to use a partition without an FS
d-i partman-basicmethods/method_only boolean false
d-i partman-auto/choose_recipe select custompartitioning
d-i partman-auto/expert_recipe string \
custompartitioning :: \
512 1 512 ext2 \
$primary{ } \
$bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
label{ boot } \
mountpoint{ /boot } \
. \
1024 1 100% ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/{{ vm_disk_device }}2 } \
vg_name{ lxc } \
. \
8192 1 8192 linux-swap \
$lvmok{ } in_vg{ lxc } \
lv_name{ swap00 } \
method{ swap } format{ } \
. \
51200 1 51200 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ root00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ root } \
mountpoint{ / } \
. \
1024 1 1000000000 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ openstack00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ openstack00 } \
mountpoint{ /openstack } \
. \
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
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
#############
#
# Packages
#
#############
# Package selection
tasksel tasksel/first multiselect openssh-server
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
d-i pkgsel/upgrade select none
d-i pkgsel/include string bridge-utils ethtool ifenslave lvm2 openssh-server python2.7 vim vlan python-simplejson
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# 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
# popular and include it on CDs.
popularity-contest popularity-contest/participate boolean false
#############
#
# Users and Password
#
#############
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
d-i passwd/root-login boolean true
# Alternatively, to skip creation of a normal user account.
d-i passwd/make-user boolean false
# The installer will warn about weak passwords. If you are sure you know
# what you're doing and want to override it, uncomment this.
d-i user-setup/allow-password-weak boolean true
# Root password, either in clear text
d-i passwd/root-password password {{ preseed_password }}
d-i passwd/root-password-again password {{ preseed_password }}
#############
#
# Bootloader
#
#############
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
#############
#
# Post Install
#
#############
d-i preseed/late_command string \
wget --no-proxy http://{{ webserver_ip_address }}/files/xenial-sources.list -O /target/etc/apt/sources.list; \
wget --no-proxy http://{{ webserver_ip_address }}/files/osa-$hostname-bridges.cfg -O /target/etc/network/interfaces.d/osa-$hostname-bridges.cfg; \
sed -i '/PermitRootLogin / s/ .*/ yes/' /target/etc/ssh/sshd_config; \
mkdir /target/root/.ssh; \
chmod 0700 /target/root/.ssh; \
echo "{{ ssh_key }}" >> /target/root/.ssh/authorized_keys; \
killall.sh || true; \
netcfg; \
echo -e '#!/bin/sh\n\nif ! grep -q "^source.*cfg$" /etc/network/interfaces; then echo "source /etc/network/interfaces.d/*.cfg" >> /etc/network/interfaces; fi' > /target/etc/network/if-pre-up.d/multi-nic; \
chmod +x /target/etc/network/if-pre-up.d/multi-nic
#############
#
# Finish
#
#############
# Reboot after the install is finished.
finish-install finish-install/reboot_in_progress note

View File

@ -0,0 +1,267 @@
#
# Ubuntu Server 16.04 Preseed
#
# Usage:
#
# This Ubuntu Preseed file is a completely unattended install.
#
# References:
#
# https://help.ubuntu.com/16.04/installation-guide/example-preseed.txt
# http://www.claudiokuenzler.com/blog/513/debian-ubuntu-preseed-create-two-volume-groups-same-disk
#############
#
# Kernel Options
#
#############
# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
# d-i debian-installer/add-kernel-opts string $kernel_options_post
#############
#
# Networking
#
#############
d-i netcfg/choose_interface select {{ vm_net_iface }}
d-i netcfg/dhcp_timeout string 60
#d-i netcfg/disable_autoconfig boolean true
#d-i netcfg/dhcp_failed note
#d-i netcfg/dhcp_options select Configure network manually
# Static network configuration.
#d-i netcfg/get_ipaddress string 192.168.0.1
#d-i netcfg/get_netmask string 255.255.255.0
#d-i netcfg/get_gateway string 192.168.0.2
#d-i netcfg/get_nameservers string 8.8.8.8
#d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string network_node
d-i netcfg/get_domain string openstackci.local
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
#############
#
# Pre Install
#
#############
# Command Line 1: This is necessary otherwise you will be prompted to umount /dev/{{ vm_disk_device }}. See Ubuntu bug #1347726.
d-i preseed/early_command string \
umount /media || true
#############
#
# Localization
#
#############
d-i debian-installer/locale string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/language string en
#############
#
# Keyboard
#
#############
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i console-setup/variantcode string
d-i keyboard-configuration/layoutcode string us
#############
#
# Mirror
#
#############
d-i mirror/country string manual
{% if tftp_proxy != 'blank' %}
d-i mirror/http/proxy string {{ tftp_proxy }}
{% endif %}
d-i mirror/http/hostname string {{ tftp_mirror }}
d-i mirror/http/directory string /ubuntu
#############
#
# Clock and Time Zone
#
#############
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string {{ ntp_server }}
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Central
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
#############
#
# Partitioning
#
#############
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/method string lvm
d-i partman-auto/disk string /dev/{{ vm_disk_device }}
# For LVM partitioning, you can select how much of the volume group to use
# for logical volumes.
d-i partman-auto-lvm/guided_size string max
# This is used to auto-confirm its OK to use a partition without an FS
d-i partman-basicmethods/method_only boolean false
d-i partman-auto/choose_recipe select custompartitioning
d-i partman-auto/expert_recipe string \
custompartitioning :: \
512 1 512 ext2 \
$primary{ } \
$bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
label{ boot } \
mountpoint{ /boot } \
. \
1024 1 100% ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/{{ vm_disk_device }}2 } \
vg_name{ lxc } \
. \
8192 1 8192 linux-swap \
$lvmok{ } in_vg{ lxc } \
lv_name{ swap00 } \
method{ swap } format{ } \
. \
153600 1 153600 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ openstack00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ openstack00 } \
mountpoint{ /openstack } \
. \
1024 1 1000000000 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ root00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ root } \
mountpoint{ / } \
. \
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
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
#############
#
# Packages
#
#############
# Package selection
tasksel tasksel/first multiselect openssh-server
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
d-i pkgsel/upgrade select none
d-i pkgsel/include string bridge-utils ethtool ifenslave lvm2 openssh-server python2.7 vim vlan python-simplejson
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# 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
# popular and include it on CDs.
popularity-contest popularity-contest/participate boolean false
#############
#
# Users and Password
#
#############
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
d-i passwd/root-login boolean true
# Alternatively, to skip creation of a normal user account.
d-i passwd/make-user boolean false
# The installer will warn about weak passwords. If you are sure you know
# what you're doing and want to override it, uncomment this.
d-i user-setup/allow-password-weak boolean true
# Root password, either in clear text
d-i passwd/root-password password {{ preseed_password }}
d-i passwd/root-password-again password {{ preseed_password }}
#############
#
# Bootloader
#
#############
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
#############
#
# Post Install
#
#############
d-i preseed/late_command string \
wget --no-proxy http://{{ webserver_ip_address }}/files/xenial-sources.list -O /target/etc/apt/sources.list; \
wget --no-proxy http://{{ webserver_ip_address }}/files/osa-$hostname-bridges.cfg -O /target/etc/network/interfaces.d/osa-$hostname-bridges.cfg; \
sed -i '/PermitRootLogin / s/ .*/ yes/' /target/etc/ssh/sshd_config; \
mkdir /target/root/.ssh; \
chmod 0700 /target/root/.ssh; \
echo "{{ ssh_key }}" >> /target/root/.ssh/authorized_keys; \
killall.sh || true; \
netcfg; \
echo -e '#!/bin/sh\n\nif ! grep -q "^source.*cfg$" /etc/network/interfaces; then echo "source /etc/network/interfaces.d/*.cfg" >> /etc/network/interfaces; fi' > /target/etc/network/if-pre-up.d/multi-nic; \
chmod +x /target/etc/network/if-pre-up.d/multi-nic
#############
#
# Finish
#
#############
# Reboot after the install is finished.
finish-install finish-install/reboot_in_progress note

View File

@ -0,0 +1,275 @@
#
# Ubuntu Server 16.04 Preseed
#
# Usage:
#
# This Ubuntu Preseed file is a completely unattended install.
#
# References:
#
# https://help.ubuntu.com/16.04/installation-guide/example-preseed.txt
# http://www.claudiokuenzler.com/blog/513/debian-ubuntu-preseed-create-two-volume-groups-same-disk
#############
#
# Kernel Options
#
#############
# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
# d-i debian-installer/add-kernel-opts string $kernel_options_post
#############
#
# Networking
#
#############
d-i netcfg/choose_interface select {{ vm_net_iface }}
d-i netcfg/dhcp_timeout string 60
#d-i netcfg/disable_autoconfig boolean true
#d-i netcfg/dhcp_failed note
#d-i netcfg/dhcp_options select Configure network manually
# Static network configuration.
#d-i netcfg/get_ipaddress string 192.168.0.1
#d-i netcfg/get_netmask string 255.255.255.0
#d-i netcfg/get_gateway string 192.168.0.2
#d-i netcfg/get_nameservers string 8.8.8.8
#d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string nova_node
d-i netcfg/get_domain string openstackci.local
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
#############
#
# Pre Install
#
#############
# Command Line 1: This is necessary otherwise you will be prompted to umount /dev/{{ vm_disk_device }}. See Ubuntu bug #1347726.
d-i preseed/early_command string \
umount /media || true
#############
#
# Localization
#
#############
d-i debian-installer/locale string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/language string en
#############
#
# Keyboard
#
#############
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i console-setup/variantcode string
d-i keyboard-configuration/layoutcode string us
#############
#
# Mirror
#
#############
d-i mirror/country string manual
{% if tftp_proxy != 'blank' %}
d-i mirror/http/proxy string {{ tftp_proxy }}
{% endif %}
d-i mirror/http/hostname string {{ tftp_mirror }}
d-i mirror/http/directory string /ubuntu
#############
#
# Clock and Time Zone
#
#############
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string {{ ntp_server }}
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Central
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
#############
#
# Partitioning
#
#############
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/method string lvm
d-i partman-auto/disk string /dev/{{ vm_disk_device }}
# For LVM partitioning, you can select how much of the volume group to use
# for logical volumes.
d-i partman-auto-lvm/guided_size string max
# This is used to auto-confirm its OK to use a partition without an FS
d-i partman-basicmethods/method_only boolean false
d-i partman-auto/choose_recipe select custompartitioning
d-i partman-auto/expert_recipe string \
custompartitioning :: \
512 1 512 ext2 \
$primary{ } \
$bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
label{ boot } \
mountpoint{ /boot } \
. \
1024 1 100% ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/{{ vm_disk_device }}2 } \
vg_name{ lxc } \
. \
8192 1 8192 linux-swap \
$lvmok{ } in_vg{ lxc } \
lv_name{ swap00 } \
method{ swap } format{ } \
. \
51200 1 51200 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ root00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ root } \
mountpoint{ / } \
. \
76800 1 76800 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ openstack00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ openstack00 } \
mountpoint{ /openstack } \
. \
1024 1 1000000000 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ nova00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ nova } \
mountpoint{ /var/lib/nova } \
. \
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
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
#############
#
# Packages
#
#############
# Package selection
tasksel tasksel/first multiselect openssh-server
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
d-i pkgsel/upgrade select none
d-i pkgsel/include string bridge-utils ethtool ifenslave lvm2 openssh-server python2.7 vim vlan python-simplejson
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# 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
# popular and include it on CDs.
popularity-contest popularity-contest/participate boolean false
#############
#
# Users and Password
#
#############
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
d-i passwd/root-login boolean true
# Alternatively, to skip creation of a normal user account.
d-i passwd/make-user boolean false
# The installer will warn about weak passwords. If you are sure you know
# what you're doing and want to override it, uncomment this.
d-i user-setup/allow-password-weak boolean true
# Root password, either in clear text
d-i passwd/root-password password {{ preseed_password }}
d-i passwd/root-password-again password {{ preseed_password }}
#############
#
# Bootloader
#
#############
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
#############
#
# Post Install
#
#############
d-i preseed/late_command string \
wget --no-proxy http://{{ webserver_ip_address }}/files/xenial-sources.list -O /target/etc/apt/sources.list; \
wget --no-proxy http://{{ webserver_ip_address }}/files/osa-$hostname-bridges.cfg -O /target/etc/network/interfaces.d/osa-$hostname-bridges.cfg; \
sed -i '/PermitRootLogin / s/ .*/ yes/' /target/etc/ssh/sshd_config; \
mkdir /target/root/.ssh; \
chmod 0700 /target/root/.ssh; \
echo "{{ ssh_key }}" >> /target/root/.ssh/authorized_keys; \
killall.sh || true; \
netcfg; \
echo -e '#!/bin/sh\n\nif ! grep -q "^source.*cfg$" /etc/network/interfaces; then echo "source /etc/network/interfaces.d/*.cfg" >> /etc/network/interfaces; fi' > /target/etc/network/if-pre-up.d/multi-nic; \
chmod +x /target/etc/network/if-pre-up.d/multi-nic
#############
#
# Finish
#
#############
# Reboot after the install is finished.
finish-install finish-install/reboot_in_progress note

View File

@ -0,0 +1,291 @@
#
# Ubuntu Server 16.04 Preseed
#
# Usage:
#
# This Ubuntu Preseed file is a completely unattended install.
#
# References:
#
# https://help.ubuntu.com/16.04/installation-guide/example-preseed.txt
# http://www.claudiokuenzler.com/blog/513/debian-ubuntu-preseed-create-two-volume-groups-same-disk
#############
#
# Kernel Options
#
#############
# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
# d-i debian-installer/add-kernel-opts string $kernel_options_post
#############
#
# Networking
#
#############
d-i netcfg/choose_interface select {{ vm_net_iface }}
d-i netcfg/dhcp_timeout string 60
#d-i netcfg/disable_autoconfig boolean true
#d-i netcfg/dhcp_failed note
#d-i netcfg/dhcp_options select Configure network manually
# Static network configuration.
#d-i netcfg/get_ipaddress string 192.168.0.1
#d-i netcfg/get_netmask string 255.255.255.0
#d-i netcfg/get_gateway string 192.168.0.2
#d-i netcfg/get_nameservers string 8.8.8.8
#d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string swift_node
d-i netcfg/get_domain string openstackci.local
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
#############
#
# Pre Install
#
#############
# Command Line 1: This is necessary otherwise you will be prompted to umount /dev/{{ vm_disk_device }}. See Ubuntu bug #1347726.
d-i preseed/early_command string \
umount /media || true
#############
#
# Localization
#
#############
d-i debian-installer/locale string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/language string en
#############
#
# Keyboard
#
#############
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
d-i console-setup/variantcode string
d-i keyboard-configuration/layoutcode string us
#############
#
# Mirror
#
#############
d-i mirror/country string manual
{% if tftp_proxy != 'blank' %}
d-i mirror/http/proxy string {{ tftp_proxy }}
{% endif %}
d-i mirror/http/hostname string {{ tftp_mirror }}
d-i mirror/http/directory string /ubuntu
#############
#
# Clock and Time Zone
#
#############
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string {{ ntp_server }}
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string US/Central
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
#############
#
# Partitioning
#
#############
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/method string lvm
d-i partman-auto/disk string /dev/{{ vm_disk_device }}
# For LVM partitioning, you can select how much of the volume group to use
# for logical volumes.
d-i partman-auto-lvm/guided_size string max
# This is used to auto-confirm its OK to use a partition without an FS
d-i partman-basicmethods/method_only boolean false
d-i partman-auto/choose_recipe select custompartitioning
d-i partman-auto/expert_recipe string \
custompartitioning :: \
512 1 512 ext2 \
$primary{ } \
$bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
label{ boot } \
mountpoint{ /boot } \
. \
1024 1 100% ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/{{ vm_disk_device }}2 } \
vg_name{ lxc } \
. \
8192 1 8192 linux-swap \
$lvmok{ } in_vg{ lxc } \
lv_name{ swap00 } \
method{ swap } format{ } \
. \
51200 1 51200 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ root00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ root } \
mountpoint{ / } \
. \
20480 1 20480 xfs \
$lvmok{ } in_vg{ lxc } \
lv_name{ swift01 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
label{ openstack00 } \
mountpoint{ /srv/disk1 } \
. \
20480 1 20480 xfs \
$lvmok{ } in_vg{ lxc } \
lv_name{ swift02 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
label{ openstack00 } \
mountpoint{ /srv/disk2 } \
. \
20480 1 20480 xfs \
$lvmok{ } in_vg{ lxc } \
lv_name{ swift03 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ xfs } \
label{ openstack00 } \
mountpoint{ /srv/disk3 } \
. \
76800 1 76800 ext4 \
$lvmok{ } in_vg{ lxc } \
lv_name{ openstack00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ openstack00 } \
mountpoint{ /openstack } \
. \
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
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
#############
#
# Packages
#
#############
# Package selection
tasksel tasksel/first multiselect openssh-server
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
d-i pkgsel/upgrade select none
d-i pkgsel/include string bridge-utils ethtool ifenslave lvm2 openssh-server python2.7 vim vlan python-simplejson xfsprogs
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# 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
# popular and include it on CDs.
popularity-contest popularity-contest/participate boolean false
#############
#
# Users and Password
#
#############
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
d-i passwd/root-login boolean true
# Alternatively, to skip creation of a normal user account.
d-i passwd/make-user boolean false
# The installer will warn about weak passwords. If you are sure you know
# what you're doing and want to override it, uncomment this.
d-i user-setup/allow-password-weak boolean true
# Root password, either in clear text
d-i passwd/root-password password {{ preseed_password }}
d-i passwd/root-password-again password {{ preseed_password }}
#############
#
# Bootloader
#
#############
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
#############
#
# Post Install
#
#############
d-i preseed/late_command string \
wget --no-proxy http://{{ webserver_ip_address }}/files/xenial-sources.list -O /target/etc/apt/sources.list; \
wget --no-proxy http://{{ webserver_ip_address }}/files/osa-$hostname-bridges.cfg -O /target/etc/network/interfaces.d/osa-$hostname-bridges.cfg; \
sed -i '/PermitRootLogin / s/ .*/ yes/' /target/etc/ssh/sshd_config; \
mkdir /target/root/.ssh; \
chmod 0700 /target/root/.ssh; \
echo "{{ ssh_key }}" >> /target/root/.ssh/authorized_keys; \
killall.sh || true; \
netcfg; \
echo -e '#!/bin/sh\n\nif ! grep -q "^source.*cfg$" /etc/network/interfaces; then echo "source /etc/network/interfaces.d/*.cfg" >> /etc/network/interfaces; fi' > /target/etc/network/if-pre-up.d/multi-nic; \
chmod +x /target/etc/network/if-pre-up.d/multi-nic
#############
#
# Finish
#
#############
# Reboot after the install is finished.
finish-install finish-install/reboot_in_progress note