Add post_install.sh script
This adds post_install.sh that is executed rigt after rpm package installation. The script does the Fuel 7.0 configuration changes required for MidoNet plugin: 1. Enables experimental features in /etc/fuel/7.0/version.yaml 2. Restarts Nailgun to apply experimental features setting 3. Adds MidoNet custom NSDB & GW Fuel roles 4. Enables MidoNet NSDB Fuel & GW deployment tasks Change-Id: I4efd71a0f98f88a3a170079e5e674266c4f35e96
This commit is contained in:
parent
9c05111f22
commit
f37b802a33
107
post_install.sh
Normal file
107
post_install.sh
Normal file
@ -0,0 +1,107 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Fuel 7.0 default deployment config hack script
|
||||
#
|
||||
|
||||
#TODO: rollback all changes on package uninstall (uninstall.sh)
|
||||
|
||||
YAML_CFG=/etc/fuel/7.0/version.yaml
|
||||
export KEYSTONE_USER=admin
|
||||
export KEYSTONE_PASS=$(sed -n '/"FUEL_ACCESS"/,/"BOOTSTRAP"/s/\(^[ ]*"password": "\)\(.*\)\("\)/\2/p' /etc/fuel/astute.yaml)
|
||||
# Fuel 7.0 maintenance upgrade totally changed astute.yaml formatting!
|
||||
[ -z "$KEYSTONE_PASS" ] && KEYSTONE_PASS=$(sed -n '/FUEL_ACCESS/,/HOSTNAME/s/\(^[ ]*password: \)\(.*\)\(\)/\2/p' /etc/fuel/astute.yaml)
|
||||
|
||||
# Enable Fuel experimental features
|
||||
if ! grep -q "\- experimental" $YAML_CFG; then
|
||||
echo "Enableing Fuel experimental features in $YAML_CFG"
|
||||
sed -i 's|^\([ ]*\)- mirantis|\0\n\1- experimental|' $YAML_CFG
|
||||
dockerctl restart nailgun > /dev/null
|
||||
echo -n "Restarting Nailgun"
|
||||
while ! fuel plugins &> /dev/null; do
|
||||
echo -n .
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
# dockerctl restart nginx
|
||||
# dockerctl shell cobbler
|
||||
# cobbler sync
|
||||
fi
|
||||
|
||||
# Generate and register additional roles
|
||||
echo "Updating MidoNet NSDB & GW Fuel roles:"
|
||||
cat > /tmp/role-nsdb.yaml << THEEND
|
||||
name: nsdb
|
||||
meta:
|
||||
name: Network State Database for MidoNet
|
||||
description: MidoNet Synchronization Services
|
||||
volumes_roles_mapping:
|
||||
- allocate_size: min
|
||||
id: os
|
||||
THEEND
|
||||
cat > /tmp/role-gw.yaml << THEEND
|
||||
name: midonet-gw
|
||||
meta:
|
||||
name: MidoNet HA Gateway
|
||||
description: MidoNet Gateway
|
||||
volumes_roles_mapping:
|
||||
- allocate_size: min
|
||||
id: os
|
||||
THEEND
|
||||
REL=$(fuel rel 2>/dev/null | grep "on Ubuntu" | awk '{ print $1 }')
|
||||
fuel role --update --rel $REL --file /tmp/role-nsdb.yaml 2> /dev/null
|
||||
fuel role --update --rel $REL --file /tmp/role-gw.yaml 2> /dev/null
|
||||
rm -rf /tmp/role-nsdb.yaml /tmp/role-gw.yaml
|
||||
|
||||
# Check if additional deployment tasks needs to be enabled
|
||||
pushd /tmp > /dev/null
|
||||
fuel rel --rel $REL --deployment-tasks --download 2> /dev/null
|
||||
if ! grep -q "\- id: nsdb" release_$REL/deployment_tasks.yaml; then
|
||||
echo "Enabling MidoNet NSDB Fuel deployment tasks"
|
||||
cat >> release_$REL/deployment_tasks.yaml << THEEND
|
||||
- id: nsdb
|
||||
parameters:
|
||||
strategy:
|
||||
type: parallel
|
||||
requires:
|
||||
- deploy_start
|
||||
required_for:
|
||||
- deploy_end
|
||||
role:
|
||||
- nsdb
|
||||
type: group
|
||||
tasks:
|
||||
- logging
|
||||
- hiera
|
||||
- globals
|
||||
- netconfig
|
||||
THEEND
|
||||
fuel rel --rel $REL --deployment-tasks --upload 2> /dev/null
|
||||
fi
|
||||
if ! grep -q "\- id: midonet-gw" release_$REL/deployment_tasks.yaml; then
|
||||
echo "Enabling MidoNet GW Fuel deployment tasks"
|
||||
cat >> release_$REL/deployment_tasks.yaml << THEEND
|
||||
- id: midonet-gw
|
||||
parameters:
|
||||
strategy:
|
||||
type: parallel
|
||||
required_for:
|
||||
- deploy_end
|
||||
requires:
|
||||
- deploy_start
|
||||
role:
|
||||
- midonet-gw
|
||||
tasks:
|
||||
- logging
|
||||
- hiera
|
||||
- globals
|
||||
- netconfig
|
||||
type: group
|
||||
THEEND
|
||||
fuel rel --rel $REL --deployment-tasks --upload 2> /dev/null
|
||||
fi
|
||||
rm -rf /tmp/release_$REL/deployment_tasks.yaml
|
||||
popd > /dev/null
|
||||
|
||||
echo Done.
|
||||
echo
|
||||
|
Loading…
Reference in New Issue
Block a user