# Ubuntu Server Preseed
# 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 biosdevname=0 net.ifnames=0 elevator=noop

# Networking
d-i netcfg/choose_interface select eth0
d-i netcfg/dhcp_timeout string 60
d-i netcfg/get_hostname string common1
d-i netcfg/get_domain string common1.openstackci.local

## USE THIS FOR STATIC NETWORKING
# 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 10.0.0.100
# d-i netcfg/get_netmask string 255.255.255.0
# d-i netcfg/get_gateway string 10.0.0.200
# d-i netcfg/get_nameservers string 8.8.8.8
# d-i netcfg/confirm_static boolean true
## USE THIS FOR STATIC NETWORKING

# 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/sda. See Ubuntu bug #1347726.
d-i preseed/early_command string \
      umount /media || true

# The kernel image (meta) package to be installed; "none" can be used if no
# kernel is to be installed.
d-i base-installer/kernel/image string {{ default_ubuntu_kernel }}

# 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
d-i mirror/http/proxy string {{ default_ubuntu_mirror_proxy }}
d-i mirror/http/hostname string {{ default_ubuntu_mirror_hostname }}
d-i mirror/http/directory string {{ default_ubuntu_mirror_directory }}

# 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.ubuntu.com

# 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
d-i partman-lvm/device_remove_lvm_span boolean true
d-i partman-auto/purge_lvm_from_device 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/sda

# 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
d-i partman-auto-lvm/new_vg_name string vmvg00

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/sda2 }                     \
                      vg_name{ vmvg00 }                       \
              .                                               \
              2048 1 4096 linux-swap                          \
                      $lvmok{ } in_vg{ vmvg00 }               \
                      lv_name{ swap00 }                       \
                      method{ swap } format{ }                \
              .                                               \
              8192 1 16384 ext4                               \
                      $lvmok{ } in_vg{ vmvg00 }               \
                      lv_name{ root00 }                       \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      label{ root }                           \
                      mountpoint{ / }                         \
              .                                               \
              16384 1 16384 ext4                              \
                      $lvmok{ } in_vg{ vmvg00 }               \
                      lv_name{ openstack00 }                  \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ ext4 }    \
                      label{ openstack }                      \
                      mountpoint{ /openstack }                \
              .                                               \
              16384 1 10240000 xfs                            \
                      $lvmok{ } in_vg{ vmvg00 }               \
                      lv_name{ nova00 }                       \
                      method{ format } format{ }              \
                      use_filesystem{ } filesystem{ xfs }     \
                      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      \
                          dstat             \
                          ethtool           \
                          git               \
                          htop              \
                          ifenslave         \
                          lvm2              \
                          openssh-server    \
                          parted            \
                          python-all        \
                          qemu-guest-agent  \
                          tmux              \
                          vim               \
                          vlan              \
                          xfsprogs

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 secrete
d-i passwd/root-password-again password secrete

# 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 \
  in-target bash -c "wget --no-proxy http://{{ tftp_server }}/scripts/vm-post-install-debian-script.sh -O /opt/vm-post-install-script.sh"; \
  in-target bash -c 'chmod +x /opt/vm-post-install-script.sh'; \
  in-target bash -c '/opt/vm-post-install-script.sh'
# Finish

# Reboot after the install is finished.
d-i finish-install/reboot_in_progress note