Merge "Fixes ceph key import failures"
[apex.git] / build / undercloud.sh
index 351eaf3..6bb8ac9 100755 (executable)
@@ -7,51 +7,61 @@
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
-set -e
+set -xe
 source ./cache.sh
 source ./variables.sh
 
 populate_cache "$rdo_images_uri/undercloud.qcow2"
-if [ ! -d images ]; then mkdir images/; fi
-cp -f cache/undercloud.qcow2 images/
+if [ ! -d "$BUILD_DIR" ]; then mkdir ${BUILD_DIR}; fi
+cp -f ${CACHE_DIR}/undercloud.qcow2 ${BUILD_DIR}/undercloud_build.qcow2
 
-#Adding OpenStack packages to undercloud
-pushd images > /dev/null
+pushd ${BUILD_DIR} > /dev/null
 
-LIBGUESTFS_BACKEND=direct virt-customize --install yum-priorities -a undercloud.qcow2
-PACKAGES="qemu-kvm-common,qemu-kvm,libvirt-daemon-kvm,libguestfs,python-libguestfs,openstack-nova-compute"
-PACKAGES+=",openstack-swift,openstack-ceilometer-api,openstack-neutron-ml2,openstack-ceilometer-alarm"
-PACKAGES+=",openstack-nova-conductor,openstack-ironic-inspector,openstack-ironic-api,python-openvswitch"
-PACKAGES+=",openstack-glance,python-glance,python-troveclient,openstack-puppet-modules"
-PACKAGES+=",openstack-neutron,openstack-neutron-openvswitch,openstack-nova-scheduler,openstack-keystone,openstack-swift-account"
-PACKAGES+=",openstack-swift-container,openstack-swift-object,openstack-swift-plugin-swift3,openstack-swift-proxy"
-PACKAGES+=",openstack-nova-api,openstack-nova-cert,openstack-heat-api-cfn,openstack-heat-api,"
-PACKAGES+=",openstack-ceilometer-central,openstack-ceilometer-polling,openstack-ceilometer-collector,"
-PACKAGES+=",openstack-heat-api-cloudwatch,openstack-heat-engine,openstack-heat-common,openstack-ceilometer-notification"
-PACKAGES+=",hiera,puppet,memcached,keepalived,mariadb,mariadb-server,rabbitmq-server,python-pbr,python-proliantutils"
-PACKAGES+=",ceph-common"
+# prep apex-tht for undercloud
+python3 -B $BUILD_UTILS clone-fork -r apex-tripleo-heat-templates
+pushd apex-tripleo-heat-templates > /dev/null
+git archive --format=tar.gz --prefix=openstack-tripleo-heat-templates/ HEAD > ${BUILD_DIR}/apex-tripleo-heat-templates.tar.gz
+popd > /dev/null
 
-# install the packages above and enabling ceph to live on the controller
-# OpenWSMan package update supports the AMT Ironic driver for the TealBox
-LIBGUESTFS_BACKEND=direct virt-customize --install $PACKAGES \
-    --run-command "sed -i '/ControllerEnableCephStorage/c\\  ControllerEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \
-    --run-command "sed -i '/  \$enable_ceph = /c\\  \$enable_ceph = true' /usr/share/openstack-tripleo-heat-templates/puppet/manifests/overcloud_controller_pacemaker.pp" \
-    --run-command "sed -i '/  \$enable_ceph = /c\\  \$enable_ceph = true' /usr/share/openstack-tripleo-heat-templates/puppet/manifests/overcloud_controller.pp" \
-    --run-command "curl http://download.opensuse.org/repositories/Openwsman/CentOS_CentOS-7/Openwsman.repo > /etc/yum.repos.d/wsman.repo" \
-    --run-command "yum update -y openwsman*" \
-    --run-command "sed -i '/pxe_wol/c\\   enabled_drivers => ['pxe_ipmitool', 'pxe_ssh', 'pxe_drac', 'pxe_ilo', 'pxe_wol', 'pxe_amt'],' /usr/share/instack-undercloud/puppet-stack-config/puppet-stack-config.pp" \
-    -a undercloud.qcow2
+# inject rt_kvm kernel rpm name into the enable file
+sed "s/kvmfornfv_kernel.rpm/$kvmfornfv_kernel_rpm/" ${BUILD_ROOT}/enable_rt_kvm.yaml | tee ${BUILD_DIR}/enable_rt_kvm.yaml
 
-# Patch in OpenDaylight installation and configuration
-LIBGUESTFS_BACKEND=direct virt-customize --upload ../opnfv-tripleo-heat-templates.patch:/tmp \
-                                         --run-command "cd /usr/share/openstack-tripleo-heat-templates/ && patch -Np1 < /tmp/opnfv-tripleo-heat-templates.patch" \
-                                         -a undercloud.qcow2
+# grab latest calipso
+populate_cache $calipso_uri_base/$calipso_script
+
+# Turn off GSSAPI Auth in sshd
+# installing forked apex-tht
+# enabling ceph OSDs to live on the controller
+# seeding configuration files specific to OPNFV
+# Add performance image scripts
+LIBGUESTFS_BACKEND=direct $VIRT_CUSTOMIZE \
+    --run-command "sed -i 's/^#UseDNS.*$/UseDNS no/' /etc/ssh/sshd_config" \
+    --run-command "sed -i 's/^GSSAPIAuthentication.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config" \
+    --upload ${BUILD_DIR}/apex-tripleo-heat-templates.tar.gz:/usr/share \
+    --install "openstack-utils" \
+    --install "ceph-common" \
+    --install openstack-nova-compute \
+    --install epel-release \
+    --install python34,python34-pip \
+    --install openstack-ironic-inspector,subunit-filters,docker-distribution,openstack-tripleo-validations \
+    --run-command "cd /usr/share && rm -rf openstack-tripleo-heat-templates && tar xzf apex-tripleo-heat-templates.tar.gz" \
+    --run-command "sed -i '/ControllerEnableCephStorage/c\\  ControllerEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \
+    --run-command "sed -i '/ComputeEnableCephStorage/c\\  ComputeEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \
+    --run-command "cp /usr/share/instack-undercloud/undercloud.conf.sample /home/stack/undercloud.conf && chown stack:stack /home/stack/undercloud.conf" \
+    --upload ${BUILD_ROOT}/opnfv-environment.yaml:/home/stack/ \
+    --upload ${BUILD_ROOT}/first-boot.yaml:/home/stack/ \
+    --upload ${BUILD_DIR}/enable_rt_kvm.yaml:/usr/share/openstack-tripleo-heat-templates/environments/ \
+    --upload ${BUILD_ROOT}/ovs-dpdk-preconfig.yaml:/home/stack/ \
+    --upload ${BUILD_ROOT}/csit-environment.yaml:/home/stack/ \
+    --upload ${BUILD_ROOT}/virtual-environment.yaml:/home/stack/ \
+    --upload ${BUILD_ROOT}/baremetal-environment.yaml:/home/stack/ \
+    --uninstall "libvirt-client" \
+    --upload ${CACHE_DIR}/${calipso_script}:/root/ \
+    --install "libguestfs-tools" \
+    --install "python-tackerclient" \
+    --run-command "yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo" \
+    --install yum-utils,lvm2,device-mapper-persistent-data \
+    -a undercloud_build.qcow2
 
-# adds tripleoclient aodh workaround
-# for keystone
-LIBGUESTFS_BACKEND=direct virt-customize --upload ../aodh-tripleoclient.patch:/tmp \
-                                         --run-command "cd /usr/lib/python2.7/site-packages/tripleoclient && patch -Np1 < /tmp/aodh-tripleoclient.patch" \
-                                         --upload ../aodh-os-cloud-config.patch:/tmp \
-                                         --run-command "cd /usr/lib/python2.7/site-packages/os_cloud_config && patch -Np1 < /tmp/aodh-os-cloud-config.patch" \
-                                         -a undercloud.qcow2
+mv -f undercloud_build.qcow2 undercloud.qcow2
 popd > /dev/null