Add python-redis to overcloud
[apex.git] / build / overcloud-full.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/overcloud-full.tar"
16 populate_cache "$openstack_congress"
17
18 if [ ! -d images/ ]; then mkdir images; fi
19 tar -xf cache/overcloud-full.tar -C images/
20 mv -f images/overcloud-full.qcow2 images/overcloud-full_build.qcow2
21
22 # Add extra space to the overcloud image
23 qemu-img resize images/overcloud-full_build.qcow2 +1G
24 LIBGUESTFS_BACKEND=direct virt-customize -a images/overcloud-full_build.qcow2 \
25                                          --run-command 'resize2fs /dev/sda'
26
27 ##########################################################
28 #####  Prep initial overcloud image with common deps #####
29 ##########################################################
30
31 # prep opnfv-puppet-tripleo for undercloud
32 clone_fork opnfv-puppet-tripleo
33 pushd opnfv-puppet-tripleo > /dev/null
34 git archive --format=tar.gz --prefix=tripleo/ HEAD > ../opnfv-puppet-tripleo.tar.gz
35 popd > /dev/null
36
37 # download customized os-net-config
38 rm -fr os-net-config
39 git clone https://github.com/trozet/os-net-config.git -b stable/colorado
40 pushd os-net-config > /dev/null
41 pushd os_net_config > /dev/null
42 git archive --format=tar.gz --prefix=os_net_config/ HEAD > ../../os-net-config.tar.gz
43 popd > /dev/null
44 popd > /dev/null
45
46 pushd images > /dev/null
47
48 dpdk_pkg_str=''
49 for package in ${dpdk_rpms[@]}; do
50   curl -O "$dpdk_uri_base/$package"
51   dpdk_pkg_str+=" --upload $package:/root/dpdk_rpms"
52 done
53
54 # tar up the congress puppet module
55 rm -rf puppet-congress
56 git clone https://github.com/radez/puppet-congress
57 pushd puppet-congress > /dev/null
58 git archive --format=tar.gz --prefix=congress/ origin/stable/mitaka > ../puppet-congress.tar.gz
59 popd > /dev/null
60
61 # installing forked opnfv-puppet-tripleo
62 # enable connection tracking for protocal sctp
63 # upload dpdk rpms but do not install
64 # enable connection tracking for protocal sctp
65 # install the congress rpms
66 # upload and explode the congress puppet module
67 # install doctor driver ## Can be removed in Newton
68 LIBGUESTFS_BACKEND=direct virt-customize \
69     --upload ../opnfv-puppet-tripleo.tar.gz:/etc/puppet/modules \
70     --run-command "if ! rpm -qa | grep python-redis; then yum install -y python-redis; fi" \
71     --run-command "sed -i 's/^#UseDNS.*$/UseDNS no/' /etc/ssh/sshd_config" \
72     --run-command "sed -i 's/^GSSAPIAuthentication.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config" \
73     --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf opnfv-puppet-tripleo.tar.gz" \
74     --run-command "echo 'nf_conntrack_proto_sctp' > /etc/modules-load.d/nf_conntrack_proto_sctp.conf" \
75     --run-command "mkdir /root/dpdk_rpms" \
76     $dpdk_pkg_str \
77     --install "centos-release-qemu-ev" \
78     --run-command "yum update -y" \
79     --run-command "yum remove -y qemu-system-x86" \
80     --upload ../os-net-config.tar.gz:/usr/lib/python2.7/site-packages \
81     --run-command "cd /usr/lib/python2.7/site-packages/ && rm -rf os_net_config && tar xzf os-net-config.tar.gz" \
82     --install "$openstack_congress" \
83     --install "python2-congressclient" \
84     --upload puppet-congress.tar.gz:/etc/puppet/modules/ \
85     --run-command "cd /etc/puppet/modules/ && tar xzf puppet-congress.tar.gz" \
86     --run-command "cd /usr/lib/python2.7/site-packages/congress/datasources && curl -O $doctor_driver" \
87     --run-command "sed -i \"s/'--detailed-exitcodes',/'--detailed-exitcodes','-l','syslog','-l','console',/g\" /var/lib/heat-config/hooks/puppet" \
88     -a overcloud-full_build.qcow2
89
90 mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
91 popd > /dev/null