4 ln -sf /etc/puppet/hiera.yaml /etc/hiera.yaml
8 if [ ! -e /root/stackrc ]; then
10 chmod 0600 /root/stackrc
12 cat >> /root/stackrc <<-EOF_CAT
13 export OS_PASSWORD=$admin_password
14 export OS_AUTH_URL=$auth_url
15 export OS_USERNAME=admin
16 export OS_TENANT_NAME=admin
17 export COMPUTE_API_VERSION=1.1
18 export NOVA_VERSION=1.1
19 export OS_BAREMETAL_API_VERSION=1.15
20 export OS_NO_CACHE=True
21 export OS_CLOUDNAME=undercloud
24 if [ -n "$ssl_certificate" ]; then
25 cat >> /root/stackrc <<-EOF_CAT
26 export PYTHONWARNINGS="ignore:Certificate has no, ignore:A true SSLContext object is not available"
33 if [ ! -f /root/.ssh/authorized_keys ]; then
34 sudo mkdir -p /root/.ssh
35 sudo chmod 7000 /root/.ssh/
36 sudo touch /root/.ssh/authorized_keys
37 sudo chmod 600 /root/.ssh/authorized_keys
40 if [ ! -f /root/.ssh/id_rsa ]; then
41 ssh-keygen -b 1024 -N '' -f /root/.ssh/id_rsa
44 if ! grep "$(cat /root/.ssh/id_rsa.pub)" /root/.ssh/authorized_keys; then
45 cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
48 if [ "$(hiera neutron_api_enabled)" = "true" ]; then
49 PHYSICAL_NETWORK=ctlplane
51 ctlplane_id=$(openstack network list -f csv -c ID -c Name --quote none | tail -n +2 | grep ctlplane | cut -d, -f1)
52 subnet_ids=$(openstack subnet list -f csv -c ID --quote none | tail -n +2)
55 for subnet_id in $subnet_ids; do
56 network_id=$(openstack subnet show -f value -c network_id $subnet_id)
57 if [ "$network_id" = "$ctlplane_id" ]; then
63 if [ -n "$subnet_id" ]; then
64 cidr=$(openstack subnet show $subnet_id -f value -c cidr)
65 if [ "$cidr" = "$undercloud_network_cidr" ]; then
68 echo "New cidr $undercloud_network_cidr does not equal old cidr $cidr"
69 echo "Will attempt to delete and recreate subnet $subnet_id"
73 if [ "$net_create" -eq "1" ]; then
74 # Delete the subnet and network to make sure it doesn't already exist
75 if openstack subnet list | grep start; then
76 openstack subnet delete $(openstack subnet list | grep start | awk '{print $4}')
78 if openstack network show ctlplane; then
79 openstack network delete ctlplane
83 NETWORK_ID=$(openstack network create --provider-network-type=flat --provider-physical-network=ctlplane ctlplane | grep " id " | awk '{print $4}')
86 if [ -n "${undercloud_nameserver:-}" ]; then
87 NAMESERVER_ARG="--dns-nameserver $undercloud_nameserver"
90 openstack subnet create --network=$NETWORK_ID \
91 --gateway=$undercloud_network_gateway \
92 --subnet-range=$undercloud_network_cidr \
93 --allocation-pool start=$undercloud_dhcp_start,end=$undercloud_dhcp_end \
94 --host-route destination=169.254.169.254/32,gateway=$local_ip \
95 $NAMESERVER_ARG ctlplane
99 if [ "$(hiera nova_api_enabled)" = "true" ]; then
100 # Disable nova quotas
101 openstack quota set --cores -1 --instances -1 --ram -1 $(openstack project show admin | awk '$2=="id" {print $4}')
104 # MISTRAL WORKFLOW CONFIGURATION
105 if [ "$(hiera mistral_api_enabled)" = "true" ]; then
107 for workbook in $(openstack workbook list | grep tripleo | cut -f 2 -d ' '); do
108 openstack workbook delete $workbook
110 for workflow in $(openstack workflow list | grep tripleo | cut -f 2 -d ' '); do
111 openstack workflow delete $workflow
113 for workbook in $(ls /usr/share/openstack-tripleo-common/workbooks/*); do
114 openstack workbook create $workbook
117 # Store the SNMP password in a mistral environment
118 if ! openstack workflow env show tripleo.undercloud-config &>/dev/null; then
119 TMP_MISTRAL_ENV=$(mktemp)
120 echo "{\"name\": \"tripleo.undercloud-config\", \"variables\": {\"undercloud_ceilometer_snmpd_password\": \"$snmp_readonly_user_password\"}}" > $TMP_MISTRAL_ENV
121 openstack workflow env create $TMP_MISTRAL_ENV
126 # IP forwarding is needed to allow the overcloud nodes access to the outside
127 # internet in cases where they are on an isolated network.
128 sysctl -w net.ipv4.ip_forward=1
130 echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/ip-forward.conf