General improvements

Adding even more dynamic user config options and a compute preseed.

Change-Id: Ieccbd61a45a77b7dff9e228fc6fdaf92df852abb
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2017-08-10 20:16:06 -05:00
parent bc8a440d42
commit 67161e5d81
No known key found for this signature in database
GPG Key ID: 69FEFFC5E2D9273F
9 changed files with 505 additions and 83 deletions

View File

@ -196,6 +196,9 @@
- src: vm-post-install-script.sh.j2
dest: "vm-post-install-{{ ansible_os_family | lower }}-script.sh"
dir: scripts
- src: compute-post-install-script.sh.j2
dest: "compute-post-install-{{ ansible_os_family | lower }}-script.sh"
dir: scripts
- name: network scripts for an MNAIO
template:
@ -250,6 +253,15 @@
group: root
with_dict: "{{ images }}"
- name: Preseeds for pxe compute
template:
src: "pxe/{{ ansible_os_family | lower }}/compute.preseed.j2"
dest: /var/lib/tftpboot/preseed/compute.preseed
mode: "0644"
owner: root
group: root
with_dict: "{{ images }}"
- name: Create netboot bind mount path
file:
path: "/var/lib/tftpboot/{{ item.value.image_short_name }}"

View File

@ -36,7 +36,7 @@ images:
image_name: "ubuntu-16.04.2-server-amd64.iso"
image_short_name: "ubuntu-16.04.2-server-amd64"
image_default_boot: "ubuntu-16.04.2-server-amd64/amd64/boot-screens/menu.cfg"
image_kernel_options: "biosdevname=0 net.ifnames=0 auto=true priority=critical vga=789"
image_kernel_options: "biosdevname=0 net.ifnames=0 auto=true priority=critical quiet splash"
image_kernel: "ubuntu-16.04.2-server-amd64/amd64/linux"
image_initrd: "ubuntu-16.04.2-server-amd64/amd64/initrd.gz"
image_netboot: "ubuntu-16.04.2-server-amd64/install/netboot/ubuntu-installer"
@ -47,13 +47,16 @@ images:
vm:
url: "tftp://{{ tftp_server }}/preseed/vm.preseed"
template_name: "vm.preseed"
compute:
url: "tftp://{{ tftp_server }}/preseed/compute.preseed"
template_name: "compute.preseed"
ubuntu-14.04-amd64:
image_type: debian
image_iso_url: "http://releases.ubuntu.com/14.04.5/ubuntu-14.04.5-server-amd64.iso"
image_name: "ubuntu-14.04.5-server-amd64.iso"
image_short_name: "ubuntu-14.04.5-server-amd64"
image_default_boot: "ubuntu-14.04.5-server-amd64/amd64/boot-screens/menu.cfg"
image_kernel_options: "biosdevname=0 net.ifnames=0 auto=true priority=critical vga=789"
image_kernel_options: "biosdevname=0 net.ifnames=0 auto=true priority=critical quiet splash"
image_kernel: "ubuntu-14.04.5-server-amd64/amd64/linux"
image_initrd: "ubuntu-14.04.5-server-amd64/amd64/initrd.gz"
image_netboot: "ubuntu-14.04.5-server-amd64/install/netboot/ubuntu-installer"
@ -64,7 +67,9 @@ images:
vm:
url: "tftp://{{ tftp_server }}/preseed/vm.preseed"
template_name: "vm.preseed"
compute:
url: "tftp://{{ tftp_server }}/preseed/compute.preseed"
template_name: "compute.preseed"
# mnaio_data_disk: 'sdc' # str - not required, set this to define a given data disk if no data disk
# is defined the largest unpartitioned disk will be used.

View File

@ -68,6 +68,9 @@ swift3
[deploy_hosts]
infra1
[loadbalancer_hosts]
loadbalancer1
############################### OSA MNAIO HOSTS ###############################
# The group "swift_hosts" is used in the MNAIO setup to create the basic drive

View File

@ -12,8 +12,8 @@ used_ips:
- "10.0.248.0,10.0.248.200"
global_overrides:
internal_lb_vip_address: "10.0.236.150"
external_lb_vip_address: "10.0.2.150"
internal_lb_vip_address: "{{ external_lb_vip_address | default(hostvars[groups['loadbalancer_hosts'][0]]['server_networks']['mgmt']['address'].split('/')[0]) }}"
external_lb_vip_address: "{{ external_lb_vip_address | default(hostvars[groups['loadbalancer_hosts'][0]]['ansible_host'].split('/')[0]) }}"
tunnel_bridge: "br-vxlan"
management_bridge: "br-mgmt"
provider_networks:

View File

@ -0,0 +1,172 @@
#!/usr/bin/env bash
# Load service variables
source /root/openrc
# Provide defaults for unset variables
# Set first two octets of network used for containers, storage, etc
NETWORK_BASE=${NETWORK_BASE:-172.29}
# Create base flavors for the new deployment
for flavor in micro tiny mini small medium large xlarge heavy; do
NAME="m1.${flavor}"
ID="${ID:-0}"
RAM="${RAM:-256}"
DISK="${DISK:-1}"
VCPU="${VCPU:-1}"
SWAP="${SWAP:-0}"
EPHEMERAL="${EPHEMERAL:-0}"
nova flavor-delete $ID > /dev/null || echo "No Flavor with ID: [ $ID ] found to clean up"
nova flavor-create $NAME $ID $RAM $DISK $VCPU --swap $SWAP --is-public true --ephemeral $EPHEMERAL --rxtx-factor 1
let ID=ID+1
let RAM=RAM*2
if [ "$ID" -gt 5 ];then
let VCPU=VCPU*2
let DISK=DISK*2
let EPHEMERAL=256
let SWAP=4
elif [ "$ID" -gt 4 ];then
let VCPU=VCPU*2
let DISK=DISK*4+$DISK
let EPHEMERAL=$DISK/2
let SWAP=4
elif [ "$ID" -gt 3 ];then
let VCPU=VCPU*2
let DISK=DISK*4+$DISK
let EPHEMERAL=$DISK/3
let SWAP=4
elif [ "$ID" -gt 2 ];then
let VCPU=VCPU+$VCPU/2
let DISK=DISK*4
let EPHEMERAL=$DISK/3
let SWAP=4
elif [ "$ID" -gt 1 ];then
let VCPU=VCPU+1
let DISK=DISK*2+$DISK
fi
done
# Neutron provider network setup
neutron net-create GATEWAY_NET \
--router:external=True \
--provider:physical_network=flat \
--provider:network_type=flat
neutron subnet-create GATEWAY_NET ${NETWORK_BASE}.248.0/22 \
--name GATEWAY_NET_SUBNET \
--gateway ${NETWORK_BASE}.248.1 \
--allocation-pool start=${NETWORK_BASE}.248.201,end=${NETWORK_BASE}.248.255 \
--dns-nameservers list=true ${DNS_NAMESERVER}
# Neutron private network setup
neutron net-create PRIVATE_NET \
--shared \
--router:external=True \
--provider:network_type=vxlan \
--provider:segmentation_id 101
neutron subnet-create PRIVATE_NET 192.168.0.0/24 \
--name PRIVATE_NET_SUBNET
# Neutron router setup
ROUTER_ID=$(neutron router-create GATEWAY_NET_ROUTER | grep -w id | awk '{print $4}')
neutron router-gateway-set \
${ROUTER_ID} \
$(neutron net-list | awk '/GATEWAY_NET/ {print $2}')
neutron router-interface-add \
${ROUTER_ID} \
$(neutron subnet-list | awk '/PRIVATE_NET_SUBNET/ {print $2}')
# Neutron security group setup
for id in $(neutron security-group-list -f yaml | awk '/- id\:/ {print $3}'); do
# Allow ICMP
neutron security-group-rule-create --protocol icmp \
--direction ingress \
$id || true
# Allow all TCP
neutron security-group-rule-create --protocol tcp \
--port-range-min 1 \
--port-range-max 65535 \
--direction ingress \
$id || true
# Allow all UDP
neutron security-group-rule-create --protocol udp \
--port-range-min 1 \
--port-range-max 65535 -\
-direction ingress \
$id || true
done
# Create some default images
wget http://uec-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img
glance image-create --name 'Ubuntu 14.04 LTS' \
--container-format bare \
--disk-format qcow2 \
--visibility public \
--progress \
--file ubuntu-14.04-server-cloudimg-amd64-disk1.img
rm ubuntu-14.04-server-cloudimg-amd64-disk1.img
wget http://uec-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img
glance image-create --name 'Ubuntu 16.04' \
--container-format bare \
--disk-format qcow2 \
--visibility public \
--progress \
--file ubuntu-16.04-server-cloudimg-amd64-disk1.img
rm ubuntu-16.04-server-cloudimg-amd64-disk1.img
wget http://dfw.mirror.rackspace.com/fedora/releases/24/CloudImages/x86_64/images/Fedora-Cloud-Base-24-1.2.x86_64.qcow2
glance image-create --name 'Fedora 24' \
--container-format bare \
--disk-format qcow2 \
--visibility public \
--progress \
--file Fedora-Cloud-Base-24-1.2.x86_64.qcow2
rm Fedora-Cloud-Base-24-1.2.x86_64.qcow2
wget http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
glance image-create --name 'CentOS 7' \
--container-format bare \
--disk-format qcow2 \
--visibility public \
--progress \
--file CentOS-7-x86_64-GenericCloud.qcow2
rm CentOS-7-x86_64-GenericCloud.qcow2
wget http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64-0.0.4-Build2.12.qcow2
glance image-create --name 'OpenSuse Leap 42' \
--container-format bare \
--disk-format qcow2 \
--visibility public \
--progress \
--file openSUSE-Leap-42.1-OpenStack.x86_64-0.0.4-Build2.12.qcow2
rm openSUSE-Leap-42.1-OpenStack.x86_64-0.0.4-Build2.12.qcow2
wget http://cdimage.debian.org/cdimage/openstack/current/debian-8.6.0-openstack-amd64.qcow2
glance image-create --name 'Debian 8.6.0' \
--container-format bare \
--disk-format qcow2 \
--visibility public \
--progress \
--file debian-8.6.0-openstack-amd64.qcow2
rm debian-8.6.0-openstack-amd64.qcow2
wget http://cdimage.debian.org/cdimage/openstack/testing/debian-testing-openstack-amd64.qcow2
glance image-create --name "Debian TESTING $(date +%m-%d-%y)" \
--container-format bare \
--disk-format qcow2 \
--visibility public \
--progress \
--file debian-testing-openstack-amd64.qcow2
rm debian-testing-openstack-amd64.qcow2
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
glance image-create --name "Cirros-0.3.4" \
--container-format bare \
--disk-format qcow2 \
--visibility public \
--progress \
--file cirros-0.3.4-x86_64-disk.img
rm cirros-0.3.4-x86_64-disk.img

View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
apt-get remove --purge snap* lxc* lxd* || true
sed -i 's/\(GRUB_CMDLINE_LINUX_DEFAULT=\).*/\1\"\"/g' /target/etc/default/grub
update-grub
sed -i '/PermitRootLogin / s/ .*/ yes/' /etc/ssh/sshd_config
mkdir -p /root/.ssh
chmod 0700 /root/.ssh
echo "{{ tftp_ssh_key }}" >> /root/.ssh/authorized_keys
wget --no-proxy http://{{ tftp_server }}/networking/$(cat /etc/hostname)-bridges.cfg -O /etc/network/interfaces.d/compute-bridges.cfg
wget --no-proxy http://{{ tftp_server }}/networking/basic-debian-interface.cfg -O /etc/network/interfaces

View File

@ -0,0 +1,235 @@
# 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=cfq
# Networking
d-i netcfg/choose_interface select eth0
d-i netcfg/dhcp_timeout string 60
d-i netcfg/get_hostname string host1
d-i netcfg/get_domain string host1.openstack.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/vda. See Ubuntu bug #1347726.
d-i preseed/early_command string \
umount /media || true
# Net Image
# Required at least for 12.10+
d-i live-installer/net-image string {{ tftp_server }}/images/{{ item.value.image_short_name }}/install/filesystem.squashfs
# 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
d-i mirror/http/hostname string archive.ubuntu.com
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.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-md/confirm boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman-basicfilesystems/choose_label string gpt
d-i partman-basicfilesystems/default_label string gpt
d-i partman-partitioning/choose_label string gpt
d-i partman-partitioning/default_label string gpt
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
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 vg00
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{ vg00 } \
. \
2048 1 4096 linux-swap \
$lvmok{ } in_vg{ vg00 } \
lv_name{ swap00 } \
method{ swap } format{ } \
. \
8192 1 16384 ext4 \
$lvmok{ } in_vg{ vg00 } \
lv_name{ root00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ root } \
mountpoint{ / } \
. \
16384 1 16384 ext4 \
$lvmok{ } in_vg{ vg00 } \
lv_name{ openstack00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ openstack } \
mountpoint{ /openstack } \
. \
16384 1 10240000 ext4 \
$lvmok{ } in_vg{ vg00 } \
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 full-upgrade
d-i pkgsel/include string bridge-utils \
dstat \
ethtool \
git \
htop \
ifenslave \
libvirt-bin \
lvm2 \
openssh-server \
parted \
python3-all \
python-all \
qemu-kvm \
systemd-container \
tmux \
vim \
virt-manager \
virtinst \
vlan
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
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string default
# Post Install
d-i preseed/late_command string \
in-target bash -c "wget --no-proxy http://{{ tftp_server }}/scripts/compute-post-install-script.sh -O /opt/compute-post-install-script.sh"; \
in-target bash -c 'chmod +x /opt/mnaio-post-install-script.sh'; \
in-target bash -c '/opt/mnaio-post-install-script.sh'
# Finish
# Reboot after the install is finished.
d-i finish-install/reboot_in_progress note

View File

@ -30,7 +30,7 @@ d-i netcfg/wireless_wep string
# Pre Install
# Command Line 1: This is necessary otherwise you will be prompted to umount /dev/vda. See Ubuntu bug #1347726.
# 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
@ -89,18 +89,9 @@ 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-md/confirm boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman-basicfilesystems/choose_label string gpt
d-i partman-basicfilesystems/default_label string gpt
d-i partman-partitioning/choose_label string gpt
d-i partman-partitioning/default_label string gpt
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
d-i partman-auto/method string raid
d-i partman-auto/disk string /dev/[sv]da /dev/[sv]db
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.
@ -108,73 +99,58 @@ d-i partman-auto-lvm/guided_size string max
d-i partman-auto-lvm/new_vg_name string vg00
d-i partman-auto/choose_recipe select custompartitioning
d-i partman-auto/expert_recipe string \
custompartitioning :: \
1 1 1 free \
$gptonly{ } \
$primary{ } \
$bios_boot{ } \
method{ biosgrub } \
. \
256 1 512 raid \
$gptonly{ } \
$lvmignore{ } \
512 1 512 ext2 \
$primary{ } \
$bootable{ } \
method{ raid } \
raidid{ 1 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext2 } \
label{ boot } \
mountpoint{ /boot } \
. \
204800 1 -1 raid \
$gptonly{ } \
$lvmignore{ } \
method{ raid } \
raidid{ 2 } \
1024 1 100% ext4 \
$primary{ } \
method{ lvm } \
device{ /dev/sda2 } \
vg_name{ vg00 } \
. \
1024 512 400% linux-swap \
$defaultignore{ } \
$lvmok{ } \
method{ swap } \
format{ } \
2048 1 4096 linux-swap \
$lvmok{ } in_vg{ vg00 } \
lv_name{ swap00 } \
method{ swap } format{ } \
. \
16384 5000 100% ext4 \
$defaultignore{ } \
$lvmok{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
8192 1 16384 ext4 \
$lvmok{ } in_vg{ vg00 } \
lv_name{ root00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ root } \
mountpoint{ / } \
. \
81920 1000 100% ext4 \
$defaultignore{ } \
$lvmok{ } \
16384 1 16384 ext4 \
$lvmok{ } in_vg{ vg00 } \
lv_name{ openstack00 } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ openstack } \
mountpoint{ /openstack } \
. \
81920 1000 100% btrfs \
$defaultignore{ } \
$lvmok{ } \
4096 1 8192 btrfs \
$lvmok{ } in_vg{ vg00 } \
lv_name{ machines00 } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ btrfs } \
method{ format } format{ } \
use_filesystem{ } filesystem{ btrfs } \
label{ machines } \
mountpoint{ /var/lib/machines } \
. \
d-i partman-auto-raid/recipe string \
0 2 0 ext2 /boot raidid=1 \
/dev/[sv]da1#/dev/[sv]db1 \
. \
0 2 0 lvm - raidid=2 \
/dev/[sv]da5#/dev/[sv]db5 \
8192 1 10240000 ext4 \
$lvmok{ } in_vg{ vg00 } \
lv_name{ lxc00 } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
label{ lxc } \
mountpoint{ /var/lib/lxc } \
. \
# This makes partman automatically partition without confirmation, provided
@ -243,6 +219,8 @@ d-i passwd/root-password-again password secrete
# 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
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string default
# Post Install

View File

@ -215,6 +215,8 @@ d-i passwd/root-password-again password secrete
# 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
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string default
# Post Install