Updating Apex to OpenStack Ocata
[apex.git] / build / undercloud.sh
1 #!/bin/sh
2 ##############################################################################
3 # Copyright (c) 2015 Tim Rozet (Red Hat), Dan Radez (Red Hat) and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 set -xe
11 source ./cache.sh
12 source ./variables.sh
13 source ./functions.sh
14
15 populate_cache "$rdo_images_uri/undercloud.qcow2"
16 if [ ! -d "$BUILD_DIR" ]; then mkdir ${BUILD_DIR}; fi
17 cp -f ${CACHE_DIR}/undercloud.qcow2 ${BUILD_DIR}/undercloud_build.qcow2
18
19 pushd ${BUILD_DIR} > /dev/null
20
21 # prep opnfv-tht for undercloud
22 clone_fork opnfv-tht
23 pushd opnfv-tht > /dev/null
24 git archive --format=tar.gz --prefix=openstack-tripleo-heat-templates/ HEAD > ${BUILD_DIR}/opnfv-tht.tar.gz
25 popd > /dev/null
26
27 # inject rt_kvm kernel rpm name into the enable file
28 sed "s/kvmfornfv_kernel.rpm/$kvmfornfv_kernel_rpm/" ${BUILD_ROOT}/enable_rt_kvm.yaml | tee ${BUILD_DIR}/enable_rt_kvm.yaml
29
30 # Turn off GSSAPI Auth in sshd
31 # installing forked opnfv-tht
32 # enabling ceph OSDs to live on the controller
33 # seeding configuration files specific to OPNFV
34 # Add performance image scripts
35 LIBGUESTFS_BACKEND=direct virt-customize \
36     --run-command "sed -i 's/^#UseDNS.*$/UseDNS no/' /etc/ssh/sshd_config" \
37     --run-command "sed -i 's/^GSSAPIAuthentication.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config" \
38     --upload ${BUILD_DIR}/opnfv-tht.tar.gz:/usr/share \
39     --install "openstack-utils" \
40     --install "ceph-common" \
41     --run-command "cd /usr/share && rm -rf openstack-tripleo-heat-templates && tar xzf opnfv-tht.tar.gz" \
42     --run-command "sed -i '/ControllerEnableCephStorage/c\\  ControllerEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \
43     --run-command "sed -i '/ComputeEnableCephStorage/c\\  ComputeEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \
44     --run-command "cp /usr/share/instack-undercloud/undercloud.conf.sample /home/stack/undercloud.conf && chown stack:stack /home/stack/undercloud.conf" \
45     --upload ${BUILD_ROOT}/opnfv-environment.yaml:/home/stack/ \
46     --upload ${BUILD_ROOT}/first-boot.yaml:/home/stack/ \
47     --upload ${BUILD_ROOT}/kvm4nfv-1st-boot.yaml:/home/stack/ \
48     --upload ${BUILD_DIR}/enable_rt_kvm.yaml:/home/stack/ \
49     --upload ${BUILD_ROOT}/ovs-dpdk-preconfig.yaml:/home/stack/ \
50     --upload ${BUILD_ROOT}/csit-environment.yaml:/home/stack/ \
51     --upload ${BUILD_ROOT}/virtual-environment.yaml:/home/stack/ \
52     --install "libguestfs-tools" \
53     -a undercloud_build.qcow2
54
55 mv -f undercloud_build.qcow2 undercloud.qcow2
56 popd > /dev/null