From 56e888a3758eb0d1df3d2ddcde6315e5154be906 Mon Sep 17 00:00:00 2001 From: Weezer Su Date: Wed, 19 Jul 2017 23:51:49 -0500 Subject: [PATCH] add deploy node into mn-aio-xenial 1, add deploy node into mn-aio-xenial 2, change the nic to eth0 because kvm needs it 3, local cache the ubuntu image for faster installation. Change-Id: I9be2493fc64481c3e6249cb5e2d36c708545ad3d --- multi-node-aio-xenial-ansible/build.sh | 3 +- .../config-deploy-node.sh | 31 ++ .../create_pxeboot_server.yml | 51 ++-- multi-node-aio-xenial-ansible/functions.rc | 16 + multi-node-aio-xenial-ansible/hosts.json | 39 +-- .../no-cobbler-configure-vms.sh | 25 ++ .../no-cobbler-create-vms.sh | 2 +- .../roles/apache_install/defaults/main.yml | 2 +- .../roles/apache_install/tasks/configure.yml | 8 +- .../apache_install/templates/sites-allowed.j2 | 4 +- .../tftpboot_configure/defaults/main.yml | 5 +- .../tftpboot_configure/tasks/configure.yml | 25 +- .../tftpboot_configure/templates/pxelinux.j2 | 2 +- ...ntu-server-16.04-unattended-cinder.seed.j2 | 15 +- ...ntu-server-16.04-unattended-deploy.seed.j2 | 276 ++++++++++++++++++ ...untu-server-16.04-unattended-infra.seed.j2 | 15 +- ...tu-server-16.04-unattended-logging.seed.j2 | 15 +- ...tu-server-16.04-unattended-network.seed.j2 | 15 +- ...rver-16.04-unattended-nova_compute.seed.j2 | 15 +- ...untu-server-16.04-unattended-swift.seed.j2 | 15 +- multi-node-aio-xenial-ansible/setup-host.sh | 4 + .../setup-pxeboot.sh | 0 .../vm.openstackci.local-bonded-bridges.cfg | 30 +- .../templates/openstack_user_config.yml | 4 +- .../deploy.openstackci.local.xml | 131 +++++++++ .../tools/downgrade-all-VMs.sh | 15 - .../tools/ubuntu-kernel-downgrade.sh | 16 - multi-node-aio-xenial-ansible/variables.sh | 11 +- 28 files changed, 668 insertions(+), 122 deletions(-) create mode 100755 multi-node-aio-xenial-ansible/config-deploy-node.sh mode change 100644 => 100755 multi-node-aio-xenial-ansible/no-cobbler-configure-vms.sh mode change 100644 => 100755 multi-node-aio-xenial-ansible/no-cobbler-create-vms.sh create mode 100644 multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-deploy.seed.j2 mode change 100644 => 100755 multi-node-aio-xenial-ansible/setup-pxeboot.sh create mode 100644 multi-node-aio-xenial-ansible/templates/vmnode-config/deploy.openstackci.local.xml delete mode 100644 multi-node-aio-xenial-ansible/tools/downgrade-all-VMs.sh delete mode 100755 multi-node-aio-xenial-ansible/tools/ubuntu-kernel-downgrade.sh diff --git a/multi-node-aio-xenial-ansible/build.sh b/multi-node-aio-xenial-ansible/build.sh index 05c1bdca..8fbaf926 100755 --- a/multi-node-aio-xenial-ansible/build.sh +++ b/multi-node-aio-xenial-ansible/build.sh @@ -45,4 +45,5 @@ CONFIGURE_VMS=${CONFIGURE_VMS:-true} # Instruct the system to deploy OpenStack Ansible DEPLOY_OSA=${DEPLOY_OSA:-true} -[[ "${DEPLOY_OSA}" = true ]] && source deploy-osa.sh +[[ "${DEPLOY_OSA}" = true ]] && source config-deploy-node.sh + diff --git a/multi-node-aio-xenial-ansible/config-deploy-node.sh b/multi-node-aio-xenial-ansible/config-deploy-node.sh new file mode 100755 index 00000000..219bf0c5 --- /dev/null +++ b/multi-node-aio-xenial-ansible/config-deploy-node.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# Load all functions +source functions.rc + +# bring in variable definitions if there is a variables.sh file +[[ -f variables.sh ]] && source variables.sh + +if [[ "${DEPLOY_OSA}" = true ]]; then + # Copy private key and public key to deploy node + scp -r -o StrictHostKeyChecking=no ~/.ssh deploy1:/root/ + + # Copy multi-node-aio folder to deploy node + scp -r -o StrictHostKeyChecking=no ../multi-node-aio deploy1:/root + + # Deploy openstack-ansible from deploy node and export all variables deploy-osa.sh needs + ssh -o StrictHostKeyChecking=no deploy1 "export NETWORK_BASE=${NETWORK_BASE} RUN_OSA=${RUN_OSA} " \ + "OSA_BRANCH=${OSA_BRANCH} PRE_CONFIG_OSA=${PRE_CONFIG_OSA}; apt update; cd /root/multi-node-aio/; ./deploy-osa.sh" +fi + +if [[ "${CONFIG_PREROUTING}" = true ]]; then + EXTERNAL_IP="$(ip route get 1 | awk '{print $NF;exit}')" + # Add 2222 rules to iptables for ssh directly into deployment node. + iptables_filter_rule_add nat "PREROUTING -p tcp -d ${EXTERNAL_IP} --dport 2222 -j DNAT --to 10.0.0.150:22" + + scp -o StrictHostKeyChecking=no deploy1:/opt/openstack-ansible/playbooks/vars/configs/haproxy_config.yml . + PORTS="$(get_osad_ports) $OSA_PORTS" + for port in $PORTS ; do + iptables_filter_rule_add nat "PREROUTING -p tcp -d ${EXTERNAL_IP} --dport ${port} -j DNAT --to 10.0.0.150:${port}" + done +fi \ No newline at end of file diff --git a/multi-node-aio-xenial-ansible/create_pxeboot_server.yml b/multi-node-aio-xenial-ansible/create_pxeboot_server.yml index c9b6d23a..4ac0a484 100644 --- a/multi-node-aio-xenial-ansible/create_pxeboot_server.yml +++ b/multi-node-aio-xenial-ansible/create_pxeboot_server.yml @@ -36,7 +36,7 @@ dhcp_default_domain_name: openstackci.local # The domain-name option - the above global default is used if this is not defined # - tftpboot_configure - tftp_mirror: archive.ubuntu.com + tftp_mirror: 10.0.0.200 tftp_proxy: "{{ proxy }}" webserver_ip_address: 10.0.0.200 @@ -45,23 +45,29 @@ tftp_source: /srv/tftp/pxelinux.cfg atftp_user: atftp atftp_group: atftp + distro_name: ubuntu-16.04.2-server-amd64.iso + distro_url : "http://releases.ubuntu.com/16.04/{{ distro_name }}" # These below variables rely on apache being set up and is where the preseed is set up - preseed_apache_url: pxe - preseed_path: /var/www/pxe + apache_url: files + apache_path: /var/www/html + + tftp_directories: + - pxe + - ubuntu # - List of static DHCP hosts - These are iterated though and each will be created # last byte of hwaddr matches last two digits of ip address server_list: - name: cinder1 - hwaddr: "52:54:00:bd:81:40" - ip: "10.0.0.140" + hwaddr: "52:54:00:bd:81:30" + ip: "10.0.0.130" distro: xenial preseed_file: ubuntu-server-16.04-unattended-cinder.seed - name: cinder2 - hwaddr: "52:54:00:bd:81:41" - ip: "10.0.0.141" + hwaddr: "52:54:00:bd:81:31" + ip: "10.0.0.131" distro: xenial preseed_file: ubuntu-server-16.04-unattended-cinder.seed @@ -90,39 +96,44 @@ preseed_file: ubuntu-server-16.04-unattended-logging.seed - name: compute1 - hwaddr: "52:54:00:bd:81:30" - ip: "10.0.0.130" + hwaddr: "52:54:00:bd:81:20" + ip: "10.0.0.120" distro: xenial preseed_file: ubuntu-server-16.04-unattended-nova_compute.seed - name: compute2 - hwaddr: "52:54:00:bd:81:31" - ip: "10.0.0.131" + hwaddr: "52:54:00:bd:81:21" + ip: "10.0.0.121" distro: xenial preseed_file: ubuntu-server-16.04-unattended-nova_compute.seed - name: swift1 - hwaddr: "52:54:00:bd:81:50" - ip: "10.0.0.150" + hwaddr: "52:54:00:bd:81:40" + ip: "10.0.0.140" distro: xenial preseed_file: ubuntu-server-16.04-unattended-swift.seed - name: swift2 - hwaddr: "52:54:00:bd:81:51" - ip: "10.0.0.151" + hwaddr: "52:54:00:bd:81:41" + ip: "10.0.0.141" distro: xenial preseed_file: ubuntu-server-16.04-unattended-swift.seed - name: swift3 - hwaddr: "52:54:00:bd:81:52" - ip: "10.0.0.152" + hwaddr: "52:54:00:bd:81:42" + ip: "10.0.0.142" distro: xenial preseed_file: ubuntu-server-16.04-unattended-swift.seed + - name: deploy1 + hwaddr: "52:54:00:bd:81:50" + ip: "10.0.0.150" + distro: xenial + preseed_file: ubuntu-server-16.04-unattended-deploy.seed + roles: - { role: proxy_install, when: proxy|length > 0 } - { role: dhcpd_install } - { role: atftpd_install } - - { role: tftpboot_configure } - - { role: apache_install, url: "{{ preseed_apache_url }}", publish_root: "{{ preseed_path }}" } - - { role: apache_install, url: files, publish_root: /var/www/html } + - { role: apache_install } + - { role: tftpboot_configure } \ No newline at end of file diff --git a/multi-node-aio-xenial-ansible/functions.rc b/multi-node-aio-xenial-ansible/functions.rc index 13b94995..45d8325a 100755 --- a/multi-node-aio-xenial-ansible/functions.rc +++ b/multi-node-aio-xenial-ansible/functions.rc @@ -239,3 +239,19 @@ contains() { echo 1 # $substring is in $string fi } + +# Return all service ports +function get_osad_ports { +python <> /etc/hosts + done + done +fi + +# Add autocomplete ssh via /etc/hosts and ssh_config to all nodes +for node in $(get_all_hosts); do + echo ' +_complete_hosts () { + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + host_list=`{ + sed -n -e "s/^[0-9][0-9\.]*//p" /etc/hosts; }|tr " " "\n"|grep -v "*"` + COMPREPLY=( $(compgen -W "\${host_list}" -- $cur)) + return 0 +} +complete -F _complete_hosts host +complete -F _complete_hosts ssh +' | ssh -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "cat >> /root/.bashrc" +done diff --git a/multi-node-aio-xenial-ansible/no-cobbler-create-vms.sh b/multi-node-aio-xenial-ansible/no-cobbler-create-vms.sh old mode 100644 new mode 100755 index c77d27a2..02bd800e --- a/multi-node-aio-xenial-ansible/no-cobbler-create-vms.sh +++ b/multi-node-aio-xenial-ansible/no-cobbler-create-vms.sh @@ -27,7 +27,7 @@ ssh_agent_reset DEVICE_NAME="${DEVICE_NAME:-vda}" # Set Ethernet type -ETH_TYPE="${ETH_TYPE:-ens}" +ETH_TYPE="${ETH_TYPE:-eth}" # Create VM Basic Configuration files for node_type in $(get_all_types); do diff --git a/multi-node-aio-xenial-ansible/roles/apache_install/defaults/main.yml b/multi-node-aio-xenial-ansible/roles/apache_install/defaults/main.yml index de387956..1ef303e7 100644 --- a/multi-node-aio-xenial-ansible/roles/apache_install/defaults/main.yml +++ b/multi-node-aio-xenial-ansible/roles/apache_install/defaults/main.yml @@ -22,5 +22,5 @@ packages: # Packages required for apache role to wor - apache2 # - variables - -url: blank # Default sub folder +apache_url: blank # Default sub folder publish_root: blank # What will the default path be for the apache site diff --git a/multi-node-aio-xenial-ansible/roles/apache_install/tasks/configure.yml b/multi-node-aio-xenial-ansible/roles/apache_install/tasks/configure.yml index f5acd554..6d887e53 100644 --- a/multi-node-aio-xenial-ansible/roles/apache_install/tasks/configure.yml +++ b/multi-node-aio-xenial-ansible/roles/apache_install/tasks/configure.yml @@ -22,19 +22,19 @@ - name: Create control file for apache site template: src: sites-allowed.j2 - dest: "/etc/apache2/sites-available/{{ url }}.conf" + dest: "/etc/apache2/sites-available/{{ apache_url }}.conf" mode: 0644 notify: restart_apache2 - name: Create publish root path file: - path: "{{ publish_root }}" + path: "{{ apache_path }}" state: directory recurse: yes - name: Enable apache site using symlink file: - path: "/etc/apache2/sites-enabled/{{ url }}.conf" - src: "/etc/apache2/sites-available/{{ url }}.conf" + path: "/etc/apache2/sites-enabled/{{ apache_url }}.conf" + src: "/etc/apache2/sites-available/{{ apache_url }}.conf" state: link notify: restart_apache2 diff --git a/multi-node-aio-xenial-ansible/roles/apache_install/templates/sites-allowed.j2 b/multi-node-aio-xenial-ansible/roles/apache_install/templates/sites-allowed.j2 index 35252335..95a91284 100644 --- a/multi-node-aio-xenial-ansible/roles/apache_install/templates/sites-allowed.j2 +++ b/multi-node-aio-xenial-ansible/roles/apache_install/templates/sites-allowed.j2 @@ -1,7 +1,7 @@ ### MANAGED BY {{ role_path|basename }} ANSIBLE ROLE ### -Alias /{{ url }} {{ publish_root }} - +Alias /{{apache_url}} {{apache_path}} + Require all granted Options +Indexes diff --git a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/defaults/main.yml b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/defaults/main.yml index c24f4d1f..cdbde4b2 100644 --- a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/defaults/main.yml +++ b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/defaults/main.yml @@ -32,13 +32,14 @@ atftp_group: nogroup # What group does this environment 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 +vm_net_iface: eth0 # Default interface used in pre-seed ssh_key: blank +distro_url: # 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 +preseed_path: /var/www/html/pxe # What path webserver_ip_address: "{{ ansible_default_ipv4.address }}" server_list: # What is our list of servers diff --git a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/tasks/configure.yml b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/tasks/configure.yml index 75e82e29..60c0efa7 100644 --- a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/tasks/configure.yml +++ b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/tasks/configure.yml @@ -24,7 +24,7 @@ - images - pxelinux.cfg -- name: Create pxeboot directories for distributions +- name: Create directories for distributions file: path: "{{ atftpd_path }}/images/{{ item }}/" state: directory @@ -32,10 +32,11 @@ group: "{{ atftp_group }}" with_items: "{{ tftp_distro }}" -- name: Create apache directories for preseed +- name: Create apache directories for preseed, ubuntu image, file: - path: "{{ preseed_path }}" + path: "{{ apache_path }}/{{ item }}" state: directory + with_items: "{{ tftp_directories }}" - name: Create the preseed files template: @@ -43,6 +44,22 @@ dest: "{{ preseed_path }}/{{ item.preseed_file }}" with_items: "{{ server_list }}" +- name: Get ubuntu server image + get_url: + url: "{{ distro_url }}" + dest: "{{ atftpd_path }}/images/{{ distro_name }}" + mode: 0644 + owner: "{{ atftp_user }}" + group: "{{ atftp_group }}" + +- name: mount the ubuntu image + mount: + name: "{{ apache_path }}/ubuntu/" + src: "{{ atftpd_path }}/images/{{ distro_name }}" + fstype: iso9660 + opts: loop + state: mounted + - name: Pull down boot kernel and initrd - create download directory -{{ tftp_distro }}- file: path: "/var/lib/netboot/{{ item }}" @@ -54,7 +71,7 @@ - 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] }}" + url: "http://{{ tftp_mirror }}/ubuntu/install/netboot/ubuntu-installer/amd64/{{ item[1] }}" dest: /var/lib/netboot/{{ item[0] }} mode: 0644 owner: "{{ atftp_user }}" diff --git a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/pxelinux.j2 b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/pxelinux.j2 index d842cc9a..8a81b1a2 100644 --- a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/pxelinux.j2 +++ b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/pxelinux.j2 @@ -4,5 +4,5 @@ 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 }} + 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 }} biosdevname=0 net.ifnames=0 diff --git a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-cinder.seed.j2 b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-cinder.seed.j2 index ed837668..39aeb83b 100644 --- a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-cinder.seed.j2 +++ b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-cinder.seed.j2 @@ -19,7 +19,7 @@ # 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 +d-i debian-installer/add-kernel-opts string biosdevname=0 net.ifnames=0 ############# # @@ -79,6 +79,15 @@ d-i console-setup/layoutcode string us d-i console-setup/variantcode string d-i keyboard-configuration/layoutcode string us +############# +# +# Net Image +# +############# + +# Required at least for 12.10+ +d-i live-installer/net-image string http://{{ tftp_mirror }}/ubuntu/install/filesystem.squashfs + ############# # # Mirror @@ -251,8 +260,8 @@ d-i grub-installer/only_debian boolean true ############# 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; \ + wget --no-proxy http://{{ webserver_ip_address }}/xenial-sources.list -O /target/etc/apt/sources.list; \ + wget --no-proxy http://{{ webserver_ip_address }}/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; \ diff --git a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-deploy.seed.j2 b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-deploy.seed.j2 new file mode 100644 index 00000000..7af9c049 --- /dev/null +++ b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-deploy.seed.j2 @@ -0,0 +1,276 @@ +# +# 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 biosdevname=0 net.ifnames=0 + +############# +# +# 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 deploy_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 + +############# +# +# Net Image +# +############# + +# Required at least for 12.10+ +d-i live-installer/net-image string http://{{ tftp_mirror }}/ubuntu/install/filesystem.squashfs + +############# +# +# 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 }}/xenial-sources.list -O /target/etc/apt/sources.list; \ + wget --no-proxy http://{{ webserver_ip_address }}/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. +d-i finish-install/reboot_in_progress note diff --git a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-infra.seed.j2 b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-infra.seed.j2 index 523d6d57..e3b79a22 100644 --- a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-infra.seed.j2 +++ b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-infra.seed.j2 @@ -19,7 +19,7 @@ # 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 +d-i debian-installer/add-kernel-opts string biosdevname=0 net.ifnames=0 ############# # @@ -79,6 +79,15 @@ d-i console-setup/layoutcode string us d-i console-setup/variantcode string d-i keyboard-configuration/layoutcode string us +############# +# +# Net Image +# +############# + +# Required at least for 12.10+ +d-i live-installer/net-image string http://{{ tftp_mirror }}/ubuntu/install/filesystem.squashfs + ############# # # Mirror @@ -246,8 +255,8 @@ d-i grub-installer/only_debian boolean true ############# 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; \ + wget --no-proxy http://{{ webserver_ip_address }}/xenial-sources.list -O /target/etc/apt/sources.list; \ + wget --no-proxy http://{{ webserver_ip_address }}/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; \ diff --git a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-logging.seed.j2 b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-logging.seed.j2 index 12661e55..df85ea43 100644 --- a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-logging.seed.j2 +++ b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-logging.seed.j2 @@ -19,7 +19,7 @@ # 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 +d-i debian-installer/add-kernel-opts string biosdevname=0 net.ifnames=0 ############# # @@ -79,6 +79,15 @@ d-i console-setup/layoutcode string us d-i console-setup/variantcode string d-i keyboard-configuration/layoutcode string us +############# +# +# Net Image +# +############# + +# Required at least for 12.10+ +d-i live-installer/net-image string http://{{ tftp_mirror }}/ubuntu/install/filesystem.squashfs + ############# # # Mirror @@ -246,8 +255,8 @@ d-i grub-installer/only_debian boolean true ############# 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; \ + wget --no-proxy http://{{ webserver_ip_address }}/xenial-sources.list -O /target/etc/apt/sources.list; \ + wget --no-proxy http://{{ webserver_ip_address }}/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; \ diff --git a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-network.seed.j2 b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-network.seed.j2 index 46a4d861..31593d1e 100644 --- a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-network.seed.j2 +++ b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-network.seed.j2 @@ -19,7 +19,7 @@ # 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 +d-i debian-installer/add-kernel-opts string biosdevname=0 net.ifnames=0 ############# # @@ -79,6 +79,15 @@ d-i console-setup/layoutcode string us d-i console-setup/variantcode string d-i keyboard-configuration/layoutcode string us +############# +# +# Net Image +# +############# + +# Required at least for 12.10+ +d-i live-installer/net-image string http://{{ tftp_mirror }}/ubuntu/install/filesystem.squashfs + ############# # # Mirror @@ -246,8 +255,8 @@ d-i grub-installer/only_debian boolean true ############# 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; \ + wget --no-proxy http://{{ webserver_ip_address }}/xenial-sources.list -O /target/etc/apt/sources.list; \ + wget --no-proxy http://{{ webserver_ip_address }}/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; \ diff --git a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-nova_compute.seed.j2 b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-nova_compute.seed.j2 index 9adf11ba..29c0b2ab 100644 --- a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-nova_compute.seed.j2 +++ b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-nova_compute.seed.j2 @@ -19,7 +19,7 @@ # 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 +d-i debian-installer/add-kernel-opts string biosdevname=0 net.ifnames=0 ############# # @@ -79,6 +79,15 @@ d-i console-setup/layoutcode string us d-i console-setup/variantcode string d-i keyboard-configuration/layoutcode string us +############# +# +# Net Image +# +############# + +# Required at least for 12.10+ +d-i live-installer/net-image string http://{{ tftp_mirror }}/ubuntu/install/filesystem.squashfs + ############# # # Mirror @@ -254,8 +263,8 @@ d-i grub-installer/only_debian boolean true ############# 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; \ + wget --no-proxy http://{{ webserver_ip_address }}/xenial-sources.list -O /target/etc/apt/sources.list; \ + wget --no-proxy http://{{ webserver_ip_address }}/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; \ diff --git a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-swift.seed.j2 b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-swift.seed.j2 index a8c100ca..1dabe98f 100644 --- a/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-swift.seed.j2 +++ b/multi-node-aio-xenial-ansible/roles/tftpboot_configure/templates/ubuntu-server-16.04-unattended-swift.seed.j2 @@ -19,7 +19,7 @@ # 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 +d-i debian-installer/add-kernel-opts string biosdevname=0 net.ifnames=0 ############# # @@ -79,6 +79,15 @@ d-i console-setup/layoutcode string us d-i console-setup/variantcode string d-i keyboard-configuration/layoutcode string us +############# +# +# Net Image +# +############# + +# Required at least for 12.10+ +d-i live-installer/net-image string http://{{ tftp_mirror }}/ubuntu/install/filesystem.squashfs + ############# # # Mirror @@ -270,8 +279,8 @@ d-i grub-installer/only_debian boolean true ############# 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; \ + wget --no-proxy http://{{ webserver_ip_address }}/xenial-sources.list -O /target/etc/apt/sources.list; \ + wget --no-proxy http://{{ webserver_ip_address }}/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; \ diff --git a/multi-node-aio-xenial-ansible/setup-host.sh b/multi-node-aio-xenial-ansible/setup-host.sh index 9d9ce485..8a17a895 100755 --- a/multi-node-aio-xenial-ansible/setup-host.sh +++ b/multi-node-aio-xenial-ansible/setup-host.sh @@ -40,6 +40,10 @@ if ! grep -q "${SSHKEY}" /root/.ssh/authorized_keys; then cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys fi +# This will prevent showing dialogs during iptables-persistent installation? +echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections +echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections + # Install basic packages known to be needed apt-get update && apt-get install -y bridge-utils ifenslave libvirt-bin lvm2 openssh-server python2.7 qemu-kvm ansible virtinst virt-manager \ vlan software-properties-common python-software-properties python-netaddr ntp qemu-utils lxc1 virtualenv \ diff --git a/multi-node-aio-xenial-ansible/setup-pxeboot.sh b/multi-node-aio-xenial-ansible/setup-pxeboot.sh old mode 100644 new mode 100755 diff --git a/multi-node-aio-xenial-ansible/templates/network-interfaces/vm.openstackci.local-bonded-bridges.cfg b/multi-node-aio-xenial-ansible/templates/network-interfaces/vm.openstackci.local-bonded-bridges.cfg index e5a0866d..48552564 100644 --- a/multi-node-aio-xenial-ansible/templates/network-interfaces/vm.openstackci.local-bonded-bridges.cfg +++ b/multi-node-aio-xenial-ansible/templates/network-interfaces/vm.openstackci.local-bonded-bridges.cfg @@ -1,30 +1,30 @@ ## Physical interface, could be bond. This only needs to be set once for the physical device # MANAGEMENT Network -auto __ETH_TYPE__10 -iface __ETH_TYPE__10 inet manual +auto __ETH_TYPE__1 +iface __ETH_TYPE__1 inet manual # FLAT Network -auto __ETH_TYPE__11 -iface __ETH_TYPE__11 inet manual +auto __ETH_TYPE__2 +iface __ETH_TYPE__2 inet manual # VLAN Network -auto __ETH_TYPE__12 -iface __ETH_TYPE__12 inet manual +auto __ETH_TYPE__3 +iface __ETH_TYPE__3 inet manual # TUNNEL Network -auto __ETH_TYPE__13 -iface __ETH_TYPE__13 inet manual +auto __ETH_TYPE__4 +iface __ETH_TYPE__4 inet manual # STORAGE Network -auto __ETH_TYPE__14 -iface __ETH_TYPE__14 inet manual +auto __ETH_TYPE__5 +iface __ETH_TYPE__5 inet manual auto br-mgmt iface br-mgmt inet static bridge_stp off bridge_waitport 10 bridge_fd 0 - bridge_ports ens10 + bridge_ports __ETH_TYPE__1 address __NETWORK_BASE__.236.__COUNT__ netmask 255.255.252.0 offload-sg off @@ -34,7 +34,7 @@ iface br-flat inet static bridge_stp off bridge_waitport 10 bridge_fd 0 - bridge_ports __ETH_TYPE__11 + bridge_ports __ETH_TYPE__2 address __NETWORK_BASE__.248.__COUNT__ netmask 255.255.252.0 offload-sg off @@ -44,7 +44,7 @@ iface br-vlan inet manual bridge_stp off bridge_waitport 10 bridge_fd 0 - bridge_ports __ETH_TYPE__12 + bridge_ports __ETH_TYPE__3 offload-sg off auto br-vxlan @@ -52,7 +52,7 @@ iface br-vxlan inet static bridge_stp off bridge_waitport 10 bridge_fd 0 - bridge_ports __ETH_TYPE__13 + bridge_ports __ETH_TYPE__4 address __NETWORK_BASE__.240.__COUNT__ netmask 255.255.252.0 offload-sg off @@ -70,7 +70,7 @@ iface br-storage inet static bridge_stp off bridge_waitport 10 bridge_fd 0 - bridge_ports __ETH_TYPE__14 + bridge_ports __ETH_TYPE__5 address __NETWORK_BASE__.244.__COUNT__ netmask 255.255.252.0 offload-sg off diff --git a/multi-node-aio-xenial-ansible/templates/openstack_user_config.yml b/multi-node-aio-xenial-ansible/templates/openstack_user_config.yml index c0762066..87d76c61 100644 --- a/multi-node-aio-xenial-ansible/templates/openstack_user_config.yml +++ b/multi-node-aio-xenial-ansible/templates/openstack_user_config.yml @@ -11,7 +11,7 @@ used_ips: - "__NETWORK_BASE__.248.0,__NETWORK_BASE__.248.200" global_overrides: - internal_lb_vip_address: __NETWORK_BASE__.236.200 + internal_lb_vip_address: __NETWORK_BASE__.236.150 # The external IP is quoted simply to ensure that the .aio file can be used as input # dynamic inventory testing. external_lb_vip_address: "__HOSTIP__" @@ -72,4 +72,4 @@ global_overrides: haproxy_hosts: loadbalancer1: - ip: __NETWORK_BASE__.236.200 + ip: __NETWORK_BASE__.236.150 diff --git a/multi-node-aio-xenial-ansible/templates/vmnode-config/deploy.openstackci.local.xml b/multi-node-aio-xenial-ansible/templates/vmnode-config/deploy.openstackci.local.xml new file mode 100644 index 00000000..4a1ef1b7 --- /dev/null +++ b/multi-node-aio-xenial-ansible/templates/vmnode-config/deploy.openstackci.local.xml @@ -0,0 +1,131 @@ + + __NODE__.openstackci.local + 4 + 4 + 4 + + /machine + + + hvm + + + + + + + + + + + + + + destroy + restart + restart + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + +