-
Notifications
You must be signed in to change notification settings - Fork 8
/
tacker_config.sh
executable file
·128 lines (112 loc) · 4.2 KB
/
tacker_config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/env bash
# Script to install/configure tacker on an Apex deployment
# author: Tim Rozet (trozet@redhat.com)
SSH_OPTIONS=(-o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o LogLevel=error)
instack_mac=$(virsh domiflist instack | grep default | \
grep -Eo "[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+:[0-9a-f\]+")
UNDERCLOUD=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
# get controller IP
node=$(ssh ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "source stackrc; nova list | grep controller | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'")
# copy host key to instack
scp ${SSH_OPTIONS[@]} ~/.ssh/id_rsa.pub "stack@$UNDERCLOUD":jumphost_id_rsa.pub
# add host key to controller authorized keys
ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" << EOI
cat ~/jumphost_id_rsa.pub | ssh -T ${SSH_OPTIONS[@]} "heat-admin@$node" 'cat >> ~/.ssh/authorized_keys'
EOI
ssh -T ${SSH_OPTIONS[@]} "heat-admin@$node" <<EOF
set -o errexit
sudo -i
/bin/bash -c "mount -o remount,inode64 /"
rm -rf python-tackerclient
git clone https://github.com/trozet/python-tackerclient.git -b SFC_refactor
pushd python-tackerclient
python setup.py build
python setup.py install
popd
# setup tacker
rm -rf tacker
git clone https://github.com/trozet/tacker.git -b SFC_brahmaputra
pushd tacker
python setup.py build
python setup.py install
rm -rf /etc/tacker
mv -f etc/tacker /etc/
chmod 755 /etc/tacker
rm -f /etc/init.d/tacker-server
mv -f etc/init.d/tacker-server /etc/init.d/tacker-server
chmod 775 /etc/init.d/tacker-server
popd
# setup puppet-tacker
rm -rf puppet-tacker
git clone https://github.com/trozet/puppet-tacker.git
rm -rf /etc/puppet/modules/tacker
mv -f puppet-tacker/ /etc/puppet/modules/tacker
# find tacker values
auth_uri=\$(hiera heat::auth_uri)
identity_uri=\$(hiera heat::identity_uri)
database_connection="mysql://tacker:tacker@\$(hiera mysql_virtual_ip)/tacker"
rabbit_host=\$(hiera rabbitmq::node_ip_address)
rabbit_password=\$(hiera nova::rabbit_password)
sql_host=\$(hiera mysql_vip)
admin_url="http://\$(hiera keystone_admin_api_vip):8888/"
public_url="http://\$(hiera keystone_public_api_vip):8888/"
allowed_hosts="[\"%\", \"\$(hiera mysql_bind_host)\"]"
heat_uri="http://\$(hiera heat_api_vip):8004/v1"
# setup local puppet module
cat > configure_tacker.pp << EOC
class { 'tacker':
package_ensure => 'absent',
client_package_ensure => 'absent',
keystone_password => 'tacker',
keystone_tenant => 'service',
auth_uri => '\${auth_uri}',
identity_uri => '\${identity_uri}',
database_connection => '\${database_connection}',
rabbit_host => '\${rabbit_host}',
rabbit_password => '\${rabbit_password}',
heat_uri => '\${heat_uri}',
}
class { 'tacker::db::mysql':
password => 'tacker',
host => '\${sql_host}',
allowed_hosts => \${allowed_hosts},
}
class { 'tacker::keystone::auth':
password => 'tacker',
tenant => 'service',
admin_url => '\${admin_url}',
internal_url => '\${admin_url}',
public_url => '\${public_url}',
region => 'regionOne',
}
EOC
# setup systemd service
cat > /usr/lib/systemd/system/openstack-tacker.service << EOC
[Unit]
Description=OpenStack Tacker Server
After=syslog.target network.target
[Service]
Type=notify
NotifyAccess=all
TimeoutStartSec=0
Restart=always
User=root
ExecStart=/etc/init.d/tacker-server start
ExecStop=/etc/init.d/tacker-server stop
[Install]
WantedBy=multi-user.target
EOC
chmod 644 /usr/lib/systemd/system/openstack-tacker.service
systemctl daemon-reload
puppet apply configure_tacker.pp
EOF
# Create sfcrc
rm -rf ./sfcrc
scp ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD":overcloudrc ./sfcrc
sed -i 's/^.*OS_USERNAME.*$/export OS_USERNAME=tacker/' sfcrc
sed -i 's/^.*OS_TENANT_NAME.*$/export OS_TENANT_NAME=service/' sfcrc
sed -i 's/^.*OS_PASSWORD.*$/export OS_PASSWORD=tacker/' sfcrc
echo "export OS_PROJECT_NAME=service" >> sfcrc
# Copy sfcrc to controller
scp ${SSH_OPTIONS[@]} ./sfcrc "heat-admin@$node":sfcrc
echo "Tacker running on Controller: ${node}. Please ssh heat-admin@${node} to access"