From 1e3823d26ef5a94f6099815f8f8f799ac3755b78 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Sun, 9 Feb 2014 15:49:27 -0500 Subject: [PATCH] Move a lot of install steps into a new element --- .../environment.d/00-source-repo-refs | 55 +++++++++ .../post-install.d/50-tripleo-incubator-path | 13 +++ .../pre-install.d/00-cleanup | 15 +++ .../pre-install.d/00-icehouse-repo | 5 + .../pre-install.d/01-iptables | 12 ++ .../undercloud-install/pre-install.d/01-pbr | 5 + .../undercloud-install/pre-install.d/01-pip | 5 + .../pre-install.d/02-erase-networkmanager | 5 + .../pre-install.d/03-remove-mariadb-log | 10 ++ .../undercloud-install/pre-install.d/04-sshd | 7 ++ .../undercloud-install/pre-install.d/skel | 5 + json-files/fedora-20-undercloud.json | 4 +- scripts/install-undercloud | 107 +----------------- 13 files changed, 144 insertions(+), 104 deletions(-) create mode 100755 elements/undercloud-install/environment.d/00-source-repo-refs create mode 100755 elements/undercloud-install/post-install.d/50-tripleo-incubator-path create mode 100755 elements/undercloud-install/pre-install.d/00-cleanup create mode 100755 elements/undercloud-install/pre-install.d/00-icehouse-repo create mode 100755 elements/undercloud-install/pre-install.d/01-iptables create mode 100755 elements/undercloud-install/pre-install.d/01-pbr create mode 100755 elements/undercloud-install/pre-install.d/01-pip create mode 100755 elements/undercloud-install/pre-install.d/02-erase-networkmanager create mode 100755 elements/undercloud-install/pre-install.d/03-remove-mariadb-log create mode 100755 elements/undercloud-install/pre-install.d/04-sshd create mode 100755 elements/undercloud-install/pre-install.d/skel diff --git a/elements/undercloud-install/environment.d/00-source-repo-refs b/elements/undercloud-install/environment.d/00-source-repo-refs new file mode 100755 index 0000000..d14b575 --- /dev/null +++ b/elements/undercloud-install/environment.d/00-source-repo-refs @@ -0,0 +1,55 @@ +#!/bin/bash + +set -eux + +export DIB_REPOTYPE_nova=tar +export +DIB_REPOLOCATION_nova=http://tarballs.openstack.org/nova/nova-2014.1.b2.tar.gz + +# The heat icehouse-2 tarball had a blocker bug +# export DIB_REPOTYPE_heat=tar +# export +# DIB_REPOLOCATION_heat=http://tarballs.openstack.org/heat/heat-2014.1.b2.tar.gz +export DIB_REPOREF_heat=5f0f9f213c6cf2ddc3ced5600efba72785a3e939 + +# Getting a 403 from: +# https://googledrive.com/host/0Bwh63zyus-UlZ1dxQ08zczVRbXc/ipaddr-2.1.11.tar.gz +# so, install keystone from package +export DIB_REPOTYPE_keystone=package +# export +# DIB_REPOLOCATION_keystone=http://tarballs.openstack.org/keystone/keystone-2014.1.b2.tar.gz + +export DIB_REPOTYPE_neutron=tar +export +DIB_REPOLOCATION_neutron=http://tarballs.openstack.org/neutron/neutron-2014.1.b2.tar.gz +export DIB_REPOTYPE_glance=tar +export +DIB_REPOLOCATION_glance=http://tarballs.openstack.org/glance/glance-2014.1.b2.tar.gz +export DIB_REPOTYPE_swift=tar +export +DIB_REPOLOCATION_swift=http://tarballs.openstack.org/swift/swift-1.11.0.tar.gz +export DIB_REOTYPE_cinder=tar +export +DIB_REPOLOCATION_cinder=http://tarballs.openstack.org/cinder/cinder-2014.1.b2.tar.gz + +# Use packages for the clients +export DIB_REPOTYPE_python_cinderclient=package +export DIB_REPOTYPE_python_glanceclient=package +export DIB_REPOTYPE_python_heatclient=package +export DIB_REPOTYPE_python_keystoneclient=package +export DIB_REPOTYPE_python_neutronclient=package +export DIB_REPOTYPE_python_novaclient=package +export DIB_REPOTYPE_python_swiftclient=package +export DIB_REPOTYPE_python_ceilometerclient=package + +export DIB_REPOTYPE_os_collect_config=tar +export +DIB_REPOLOCATION_os_collect_config=http://tarballs.openstack.org/os-collect-config/os-collect-config-0.1.10.tar.gz +export DIB_REPOTYPE_os_refresh_config=tar +export +DIB_REPOLOCATION_os_refresh_config=http://tarballs.openstack.org/os-refresh-config/os-refresh-config-0.0.7.tar.gz +export DIB_REPOTYPE_os_apply_config=tar +export +DIB_REPOLOCATION_os_apply_config=http://tarballs.openstack.org/os-apply-config/os-apply-config-0.1.11.tar.gz + + diff --git a/elements/undercloud-install/post-install.d/50-tripleo-incubator-path b/elements/undercloud-install/post-install.d/50-tripleo-incubator-path new file mode 100755 index 0000000..e88a33f --- /dev/null +++ b/elements/undercloud-install/post-install.d/50-tripleo-incubator-path @@ -0,0 +1,13 @@ +#!/bin/bash + +set -eux + +# Add scripts directory from tripleo-incubator and diskimage-builder to the +# path. +# These scripts can't just be symlinked into a bin directory because they do +# directory manipulation that assumes they're in a known location. +if [ ! -e /etc/profile.d/tripleo-incubator-scripts.sh ]; then + sudo bash -c "echo export PATH='\$PATH':/opt/stack/tripleo-incubator/scripts/ >> /etc/profile.d/tripleo-incubator-scripts.sh" + sudo bash -c "echo export PATH=/opt/stack/diskimage-builder/bin/:'\$PATH' >> /etc/profile.d/tripleo-incubator-scripts.sh" +fi + diff --git a/elements/undercloud-install/pre-install.d/00-cleanup b/elements/undercloud-install/pre-install.d/00-cleanup new file mode 100755 index 0000000..4a9dcf9 --- /dev/null +++ b/elements/undercloud-install/pre-install.d/00-cleanup @@ -0,0 +1,15 @@ +#!/bin/bash + +set -eux + +# Clean up from any previous runs... +# TODO: figure out if we want upstream patches for this along the lines of a +# "cleanup" element that cleans up the environment at the very beginning of a +# run. +sudo rm -rf \ + /var/lib/use-ephemeral \ + /etc/neutron/plugin.ini \ + /opt/stack \ + /usr/local/bin/* \ + /mnt/state \ + /var/lib/heat-cfntools diff --git a/elements/undercloud-install/pre-install.d/00-icehouse-repo b/elements/undercloud-install/pre-install.d/00-icehouse-repo new file mode 100755 index 0000000..8a59ccc --- /dev/null +++ b/elements/undercloud-install/pre-install.d/00-icehouse-repo @@ -0,0 +1,5 @@ +#!/bin/bash + +set -eux + +install-packages http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/rdo-release-icehouse-1.noarch.rpm diff --git a/elements/undercloud-install/pre-install.d/01-iptables b/elements/undercloud-install/pre-install.d/01-iptables new file mode 100755 index 0000000..c93f7ed --- /dev/null +++ b/elements/undercloud-install/pre-install.d/01-iptables @@ -0,0 +1,12 @@ +#!/bin/bash + +set -eux + +# Needed for our iptables rules +yum -y erase firewalld +install-packages iptables-services +# This does not happen automatically, but is required in the systemd service +# file for iptables: ConditionPathExists=/etc/sysconfig/iptables +touch /etc/sysconfig/iptables +os-svc-enable -n iptables +os-svc-restart -n iptables diff --git a/elements/undercloud-install/pre-install.d/01-pbr b/elements/undercloud-install/pre-install.d/01-pbr new file mode 100755 index 0000000..cc2a12d --- /dev/null +++ b/elements/undercloud-install/pre-install.d/01-pbr @@ -0,0 +1,5 @@ +#!/bin/bash + +set -eux + +install-packages python-pbr diff --git a/elements/undercloud-install/pre-install.d/01-pip b/elements/undercloud-install/pre-install.d/01-pip new file mode 100755 index 0000000..5d1adf5 --- /dev/null +++ b/elements/undercloud-install/pre-install.d/01-pip @@ -0,0 +1,5 @@ +#!/bin/bash + +set -eux + +install-packages python-pip diff --git a/elements/undercloud-install/pre-install.d/02-erase-networkmanager b/elements/undercloud-install/pre-install.d/02-erase-networkmanager new file mode 100755 index 0000000..300767e --- /dev/null +++ b/elements/undercloud-install/pre-install.d/02-erase-networkmanager @@ -0,0 +1,5 @@ +#!/bin/bash + +set -eux + +yum -y erase NetworkManager diff --git a/elements/undercloud-install/pre-install.d/03-remove-mariadb-log b/elements/undercloud-install/pre-install.d/03-remove-mariadb-log new file mode 100755 index 0000000..45fb17b --- /dev/null +++ b/elements/undercloud-install/pre-install.d/03-remove-mariadb-log @@ -0,0 +1,10 @@ +#!/bin/bash + +set -eux + +# Workaround for: +# https://bugzilla.redhat.com/show_bug.cgi?id=1061045 +# Go ahead and install mariadb-server, and remove the logfile with wrong +# permissions. +install-packages mariadb-server +rm -f /var/log/mariadb/mariadb.log diff --git a/elements/undercloud-install/pre-install.d/04-sshd b/elements/undercloud-install/pre-install.d/04-sshd new file mode 100755 index 0000000..2cbf0d0 --- /dev/null +++ b/elements/undercloud-install/pre-install.d/04-sshd @@ -0,0 +1,7 @@ +#!/bin/bash + +set -eux + +# Make sure ssh is enabled and running +systemctl enable sshd +systemctl start sshd diff --git a/elements/undercloud-install/pre-install.d/skel b/elements/undercloud-install/pre-install.d/skel new file mode 100755 index 0000000..04ae684 --- /dev/null +++ b/elements/undercloud-install/pre-install.d/skel @@ -0,0 +1,5 @@ +#!/bin/bash + +set -eux + + diff --git a/json-files/fedora-20-undercloud.json b/json-files/fedora-20-undercloud.json index 6b86f97..ae85478 100644 --- a/json-files/fedora-20-undercloud.json +++ b/json-files/fedora-20-undercloud.json @@ -13,13 +13,15 @@ }, { "element": [ + "undercloud-install", "fedora", "boot-stack", "nova-baremetal", "os-collect-config", "dhcp-all-interfaces", "neutron-dhcp-agent", - "undercloud-stack-config" + "undercloud-stack-config", + "selinux-permissive" ], "hook": [ "extra-data", diff --git a/scripts/install-undercloud b/scripts/install-undercloud index 5e48477..71d46e7 100755 --- a/scripts/install-undercloud +++ b/scripts/install-undercloud @@ -9,48 +9,15 @@ mkdir -p ~/.instack exec > >(tee $LOGFILE) exec 2>&1 -# As always... -sudo setenforce 0 -sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config - -# Enable icehouse rpm's repo -sudo yum -y install http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/rdo-release-icehouse-1.noarch.rpm || true - -# Can be removed once everything is packaged -sudo yum -y install python-pip - -# Needed for our iptables rules -sudo yum -y erase firewalld -sudo yum -y install iptables-services -# This does not happen automatically, but is required in the systemd service -# file for iptables: ConditionPathExists=/etc/sysconfig/iptables -sudo touch /etc/sysconfig/iptables -sudo systemctl enable iptables -sudo systemctl start iptables - -# NetworkManager messes up our network config -sudo yum -y erase NetworkManager - -# Workaround for: -# https://bugzilla.redhat.com/show_bug.cgi?id=1061045 -# Go ahead and install mariadb-server, and remove the logfile with wrong -# permissions. -sudo yum -y install mariadb-server -sudo rm -f /var/log/mariadb/mariadb.log - -# Make sure ssh is enabled and running -sudo systemctl enable sshd -sudo systemctl start sshd - pushd instack -sudo pip install -e . + sudo pip install -e . popd # Upstream dib is fine if [ ! -d diskimage-builder ]; then git clone https://git.openstack.org/openstack/diskimage-builder pushd diskimage-builder - sudo python setup.py install + sudo python setup.py install popd fi @@ -58,70 +25,13 @@ fi if [ ! -d tripleo-image-elements ]; then git clone https://github.com/slagle/tripleo-image-elements pushd tripleo-image-elements - git checkout undercloud-stack-config + git checkout undercloud-stack-config popd fi -# Clean up from any previous runs... -# TODO: figure out if we want upstream patches for this along the lines of a -# "cleanup" element that cleans up the environment at the very beginning of a -# run. -sudo rm -rf \ - /var/lib/use-ephemeral \ - /etc/neutron/plugin.ini \ - /opt/stack \ - /usr/local/bin/* \ - /mnt/state \ - /var/lib/heat-cfntools - - -# yea.... +# Needed by source-repositories sudo yum -y install tar -# nova-manage db sync requires pbr to be installed at runtime when installed -# from tarball -sudo yum -y install python-pbr - -export DIB_REPOTYPE_nova=tar -export DIB_REPOLOCATION_nova=http://tarballs.openstack.org/nova/nova-2014.1.b2.tar.gz - -# The heat icehouse-2 tarball had a blocker bug -# export DIB_REPOTYPE_heat=tar -# export DIB_REPOLOCATION_heat=http://tarballs.openstack.org/heat/heat-2014.1.b2.tar.gz -export DIB_REPOREF_heat=5f0f9f213c6cf2ddc3ced5600efba72785a3e939 - -# Getting a 403 from: -# https://googledrive.com/host/0Bwh63zyus-UlZ1dxQ08zczVRbXc/ipaddr-2.1.11.tar.gz -# so, install keystone from package -export DIB_REPOTYPE_keystone=package -# export DIB_REPOLOCATION_keystone=http://tarballs.openstack.org/keystone/keystone-2014.1.b2.tar.gz - -export DIB_REPOTYPE_neutron=tar -export DIB_REPOLOCATION_neutron=http://tarballs.openstack.org/neutron/neutron-2014.1.b2.tar.gz -export DIB_REPOTYPE_glance=tar -export DIB_REPOLOCATION_glance=http://tarballs.openstack.org/glance/glance-2014.1.b2.tar.gz -export DIB_REPOTYPE_swift=tar -export DIB_REPOLOCATION_swift=http://tarballs.openstack.org/swift/swift-1.11.0.tar.gz -export DIB_REOTYPE_cinder=tar -export DIB_REPOLOCATION_cinder=http://tarballs.openstack.org/cinder/cinder-2014.1.b2.tar.gz - -# Use packages for the clients -export DIB_REPOTYPE_python_cinderclient=package -export DIB_REPOTYPE_python_glanceclient=package -export DIB_REPOTYPE_python_heatclient=package -export DIB_REPOTYPE_python_keystoneclient=package -export DIB_REPOTYPE_python_neutronclient=package -export DIB_REPOTYPE_python_novaclient=package -export DIB_REPOTYPE_python_swiftclient=package -export DIB_REPOTYPE_python_ceilometerclient=package - -export DIB_REPOTYPE_os_collect_config=tar -export DIB_REPOLOCATION_os_collect_config=http://tarballs.openstack.org/os-collect-config/os-collect-config-0.1.10.tar.gz -export DIB_REPOTYPE_os_refresh_config=tar -export DIB_REPOLOCATION_os_refresh_config=http://tarballs.openstack.org/os-refresh-config/os-refresh-config-0.0.7.tar.gz -export DIB_REPOTYPE_os_apply_config=tar -export DIB_REPOLOCATION_os_apply_config=http://tarballs.openstack.org/os-apply-config/os-apply-config-0.1.11.tar.gz - INSTACK_DIR=$(dirname $0)/.. source $INSTACK_DIR/instack.answers @@ -143,15 +53,6 @@ sudo -E instack \ -p diskimage-builder/elements/ tripleo-image-elements/elements/ \ -j instack/json-files/fedora-20-undercloud.json -# Add scripts directory from tripleo-incubator and diskimage-builder to the -# path. -# These scripts can't just be symlinked into a bin directory because they do -# directory manipulation that assumes they're in a known location. -if [ ! -e /etc/profile.d/tripleo-incubator-scripts.sh ]; then - sudo bash -c "echo export PATH='\$PATH':/opt/stack/tripleo-incubator/scripts/ >> /etc/profile.d/tripleo-incubator-scripts.sh" - sudo bash -c "echo export PATH=/opt/stack/diskimage-builder/bin/:'\$PATH' >> /etc/profile.d/tripleo-incubator-scripts.sh" -fi - sudo os-refresh-config echo "install-undercloud Complete!"