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
This commit is contained in:
Weezer Su 2017-07-19 23:51:49 -05:00
parent 2c4f4cc434
commit 56e888a375
28 changed files with 668 additions and 122 deletions

View File

@ -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

View File

@ -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

View File

@ -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 }

View File

@ -239,3 +239,19 @@ contains() {
echo 1 # $substring is in $string
fi
}
# Return all service ports
function get_osad_ports {
python <<EOL
import yaml
with open('haproxy_config.yml') as f:
x = yaml.safe_load(f.read())
haproxy_services = (x.get('haproxy_default_services')
or x.get('haproxy_service_configs'))
for i in haproxy_services:
y = i['service'].get('haproxy_port')
if isinstance(y, int):
print y
EOL
}

View File

@ -1,23 +1,26 @@
{
"cinder": {
"cinder1": "140",
"cinder2": "141"
},
"infra": {
"infra": {
"infra1": "100",
"infra2": "101",
"infra3": "102"
},
"logging": {
"logging1": "110"
},
"nova_compute": {
"compute1": "130",
"compute2": "131"
},
"swift": {
"swift1": "150",
"swift2": "151",
"swift3": "152"
}
},
"logging": {
"logging1": "110"
},
"nova_compute": {
"compute1": "120",
"compute2": "121"
},
"cinder": {
"cinder1": "130",
"cinder2": "131"
},
"swift": {
"swift1": "140",
"swift2": "141",
"swift3": "142"
},
"deploy": {
"deploy1":"150"
}
}

View File

@ -54,3 +54,28 @@ for node in $(get_all_hosts); do
apt-get clean; \
apt-get update"
done
# Add node hostname into /etc/hosts
if ! grep -q "10.0.0.150" /etc/hosts; then
for node_type in $(get_all_types); do
for node in $(get_host_type ${node_type}); do
echo "10.0.0.${node#*":"} ${node%%':'*}" >> /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

2
multi-node-aio-xenial-ansible/no-cobbler-create-vms.sh Normal file → Executable file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,7 +1,7 @@
### MANAGED BY {{ role_path|basename }} ANSIBLE ROLE ###
Alias /{{ url }} {{ publish_root }}
<Directory {{ publish_root }}>
Alias /{{apache_url}} {{apache_path}}
<Directory {{ apache_path }}>
Require all granted
Options +Indexes
</Directory>

View File

@ -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

View File

@ -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 }}"

View File

@ -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

View File

@ -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; \

View File

@ -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

View File

@ -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; \

View File

@ -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; \

View File

@ -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; \

View File

@ -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; \

View File

@ -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; \

View File

@ -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 \

0
multi-node-aio-xenial-ansible/setup-pxeboot.sh Normal file → Executable file
View File

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,131 @@
<domain type='kvm'>
<name>__NODE__.openstackci.local</name>
<memory unit='GiB'>4</memory>
<currentMemory unit='GiB'>4</currentMemory>
<vcpu placement='static'>4</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
</os>
<features>
<acpi/>
<apic/>
</features>
<cpu mode='host-model'>
<model fallback='allow'/>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none' io='native'/>
<source file='/var/lib/libvirt/images/__NODE__.openstackci.local.img'/>
<target dev='__DEVICE_NAME__' bus='virtio'/>
<boot order='1'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci.0'/>
</controller>
<controller type='virtio-serial' index='0'>
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address="52:54:00:bd:81:__COUNT__"/>
<source bridge='br-dhcp'/>
<target dev='vnet0'/>
<model type='virtio'/>
<boot order='2'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<interface type='bridge'>
<mac address="52:54:00:fd:7f:__COUNT__"/>
<source bridge='vm-br-eth1'/>
<target dev='vnet1'/>
<model type='virtio'/>
<boot order='3'/>
<alias name='net1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</interface>
<interface type='bridge'>
<mac address="52:54:00:f5:44:__COUNT__"/>
<source bridge='vm-br-eth2'/>
<target dev='vnet2'/>
<model type='virtio'/>
<boot order='4'/>
<alias name='net2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
</interface>
<interface type='bridge'>
<mac address="52:54:00:1f:96:__COUNT__"/>
<source bridge='vm-br-eth3'/>
<target dev='vnet3'/>
<model type='virtio'/>
<boot order='5'/>
<alias name='net3'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
</interface>
<interface type='bridge'>
<mac address="52:54:00:50:03:__COUNT__"/>
<source bridge='vm-br-eth4'/>
<target dev='vnet4'/>
<model type='virtio'/>
<boot order='6'/>
<alias name='net4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
</interface>
<interface type='bridge'>
<mac address="52:54:00:2d:12:__COUNT__"/>
<source bridge='vm-br-eth5'/>
<target dev='vnet5'/>
<model type='virtio'/>
<boot order='7'/>
<alias name='net5'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/4'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/4'>
<source path='/dev/pts/4'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<model type='vmvga' vram='1024' heads='1'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</memballoon>
<rng model='virtio'>
<backend model='random'>/dev/random</backend>
<alias name='rng0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</rng>
</devices>
</domain>

View File

@ -1,15 +0,0 @@
#!/bin/bash
#eg. KERNEL_VERSION="3.13.0-98"
KERNEL_VERSION=${KERNEL_VERSION:-false}
if [[ "${KERNEL_VERSION}" = false ]]; then
echo "Please setup the KERNEL_VERSION before running this script"
exit 1
fi
pushd ..
source functions.rc
for node in $(get_all_hosts); do
ssh -q -t -o StrictHostKeyChecking=no 10.0.0.${node#*":"} KERNEL_VERSION="${KERNEL_VERSION}" 'bash -s' < tools/ubuntu-downgrade.sh
done

View File

@ -1,16 +0,0 @@
#!/bin/sh
#eg. KERNEL_VERSION="3.13.0-98"
KERNEL_VERSION=${KERNEL_VERSION:-false}
if [[ "${KERNEL_VERSION}" = false ]]; then
echo "Please setup the KERNEL_VERSION before running this script"
exit 1
fi
sudo apt-get update
sudo aptitude install -y linux-image-${KERNEL_VERSION}-generic \
linux-headers-${KERNEL_VERSION} linux-image-extra-${KERNEL_VERSION}-generic
sudo sed -i "s/GRUB_DEFAULT=.*/GRUB_DEFAULT=\"Advanced options for Ubuntu>Ubuntu, with Linux ${KERNEL_VERSION}-generic\"/" /etc/default/grub
sudo update-grub
sudo reboot

View File

@ -17,7 +17,7 @@ OSA_BRANCH="${OSA_BRANCH:-stable/newton}"
DEVICE_NAME="${DEVICE_NAME:-vda}"
# What default network device should we use
DEFAULT_NETWORK="${DEFAULT_NETWORK:-ens3}"
DEFAULT_NETWORK="${DEFAULT_NETWORK:-eth0}"
# What is the default virtual machine disk size in GB
VM_DISK_SIZE="${VM_DISK_SIZE:-252}"
@ -64,4 +64,11 @@ CONTAINER_VMS="${CONTAINER_VMS:-xenial}"
# Ethernet type, this needs to be ens for Xenial and is for
# templates/network-interfaces/vm.openstackci.local-bonded-bridges.cfg file
ETH_TYPE="${ETH_TYPE:-ens}"
ETH_TYPE="${ETH_TYPE:-eth}"
# Default service ports
OSA_PORTS="${OSA_PORTS:-6080 6082 443 80}"
# Config the baremetal host, treat the baremetal host as a switch
# put all deploy job into deploy node.
CONFIG_PREROUTING="${CONFIG_PREROUTING:-true}"