Adds missing packages to undercloud
[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 -e
11 source ./cache.sh
12 source ./variables.sh
13 source ./functions.sh
14
15 populate_cache "$rdo_images_uri/undercloud.qcow2"
16 if [ ! -d images ]; then mkdir images/; fi
17 cp -f cache/undercloud.qcow2 images/undercloud_build.qcow2
18
19 # prep opnfv-tht for undercloud
20 clone_fork opnfv-tht
21 pushd opnfv-tht > /dev/null
22 git archive --format=tar.gz --prefix=openstack-tripleo-heat-templates/ HEAD > ../opnfv-tht.tar.gz
23 popd > /dev/null
24
25 cat > /tmp/tacker.repo << EOF
26 [tacker-trozet]
27 name=Tacker RPMs built from https://github.com/trozet/ tacker repositories
28 baseurl=http://radez.fedorapeople.org/tacker/
29 enabled=1
30 gpgcheck=0
31 EOF
32
33 pushd images > /dev/null
34 # installing forked opnfv-tht
35 # enabling ceph OSDs to live on the controller
36 # OpenWSMan package update supports the AMT Ironic driver for the TealBox
37 # seeding configuration files specific to OPNFV
38 # add congress client and apply: https://review.openstack.org/#/c/297515/
39 # add congress password to python-triploclient
40 # add tacker password to python-tripleoclient
41 # upload tacker repo and install the client package
42 LIBGUESTFS_BACKEND=direct virt-customize \
43     --upload ../opnfv-tht.tar.gz:/usr/share \
44     --run-command "cd /usr/share && rm -rf openstack-tripleo-heat-templates && tar xzf opnfv-tht.tar.gz" \
45     --run-command "sed -i '/ControllerEnableCephStorage/c\\  ControllerEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \
46     --run-command "sed -i '/ComputeEnableCephStorage/c\\  ComputeEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \
47     --run-command "curl http://download.opensuse.org/repositories/Openwsman/CentOS_CentOS-7/Openwsman.repo > /etc/yum.repos.d/wsman.repo" \
48     --run-command "yum update -y openwsman*" \
49     --run-command "cp /usr/share/instack-undercloud/undercloud.conf.sample /home/stack/undercloud.conf && chown stack:stack /home/stack/undercloud.conf" \
50     --upload ../opnfv-environment.yaml:/home/stack/ \
51     --upload ../virtual-environment.yaml:/home/stack/ \
52     --install "python2-congressclient" \
53     --upload ../python-congressclient.diff:/tmp \
54     --run-command "cd /usr/lib/python2.7/site-packages && patch -p1 < /tmp/python-congressclient.diff" \
55     --run-command "sed -i '/SERVICE_LIST/a\\    \x27congress\x27: {\x27password_field\x27: \x27OVERCLOUD_CONGRESS_PASSWORD\x27},' /usr/lib/python2.7/site-packages/tripleoclient/constants.py" \
56     --run-command "sed -i '/PASSWORD_NAMES =/a\\    \"OVERCLOUD_CONGRESS_PASSWORD\",' /usr/lib/python2.7/site-packages/tripleoclient/utils.py" \
57     --run-command "sed -i '/AodhPassword/a\\        parameters\[\x27CongressPassword\x27\] = passwords\[\x27OVERCLOUD_CONGRESS_PASSWORD\x27\]' /usr/lib/python2.7/site-packages/tripleoclient/v1/overcloud_deploy.py" \
58     --run-command "sed -i '/^SERVICES/a\    \x27congress\x27: {\x27description\x27: \x27Congress Service\x27, \x27type\x27: \x27policy\x27, \x27path\x27: \x27/\x27, \x27port\x27: 1789 },' /usr/lib/python2.7/site-packages/os_cloud_config/keystone.py" \
59     --run-command "sed -i '/SERVICE_LIST/a\\    \x27tacker\x27: {\x27password_field\x27: \x27OVERCLOUD_TACKER_PASSWORD\x27},' /usr/lib/python2.7/site-packages/tripleoclient/constants.py" \
60     --run-command "sed -i '/PASSWORD_NAMES =/a\\    \"OVERCLOUD_TACKER_PASSWORD\",' /usr/lib/python2.7/site-packages/tripleoclient/utils.py" \
61     --run-command "sed -i '/AodhPassword/a\\        parameters\[\x27TackerPassword\x27\] = passwords\[\x27OVERCLOUD_TACKER_PASSWORD\x27\]' /usr/lib/python2.7/site-packages/tripleoclient/v1/overcloud_deploy.py" \
62     --run-command "sed -i '/^SERVICES/a\    \x27tacker\x27: {\x27description\x27: \x27Tacker Service\x27, \x27type\x27: \x27servicevm\x27, \x27path\x27: \x27/\x27, \x27port\x27: 1789 },' /usr/lib/python2.7/site-packages/os_cloud_config/keystone.py" \
63     --upload /tmp/tacker.repo:/etc/yum.repos.d/ \
64     --install "python-tackerclient" \
65     --install "python2-aodhclient" \
66     --install "openstack-heat-engine" \
67     --install "openstack-heat-api-cfn" \
68     --install "openstack-heat-api" \
69     -a undercloud_build.qcow2
70
71 # Add custom IPA to allow kernel params
72 wget https://raw.githubusercontent.com/trozet/ironic-python-agent/opnfv_kernel/ironic_python_agent/extensions/image.py
73 python3.4 -c 'import py_compile; py_compile.compile("image.py", cfile="image.pyc")'
74
75 # Add performance image scripts
76 LIBGUESTFS_BACKEND=direct virt-customize --upload ../build_perf_image.sh:/home/stack \
77                                          --upload ../set_perf_images.sh:/home/stack \
78                                          --upload image.py:/root \
79                                          --upload image.pyc:/root \
80                                          -a undercloud_build.qcow2
81
82 mv -f undercloud_build.qcow2 undercloud.qcow2
83 popd > /dev/null