diff options
5 files changed, 238 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/deploychef/files/run-deploychef b/meta-openstack/recipes-support/deploychef/files/run-deploychef new file mode 100644 index 0000000..03e8807 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/run-deploychef | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # run-chefsolo | ||
| 3 | # | ||
| 4 | # Copyright (c) 2014 Wind River Systems, Inc. | ||
| 5 | # | ||
| 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 7 | # of this software and associated documentation files (the "Software"), to deal | ||
| 8 | # in the Software without restriction, including without limitation the rights | ||
| 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 10 | # copies of the Software, and to permit persons to whom the Software is | ||
| 11 | # furnished to do so, subject to the following conditions: | ||
| 12 | # | ||
| 13 | # The above copyright notice and this permission notice shall be included in | ||
| 14 | # all copies or substantial portions of the Software. | ||
| 15 | |||
| 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 22 | # THE SOFTWARE. | ||
| 23 | # | ||
| 24 | # | ||
| 25 | # This file is the main file that the install will call in order to reconfig | ||
| 26 | # and Openstack node | ||
| 27 | # bash run-chefsolo | ||
| 28 | # | ||
| 29 | # | ||
| 30 | #Shutdown all openstack modules | ||
| 31 | bash service-shutdown | ||
| 32 | #Use chefsolo to bake our recipe and generate configuration files/scripts | ||
| 33 | chef-solo -f -c config.rb -j attributes.json | ||
| 34 | #Workaround to force the files to be copied from postinsts dir | ||
| 35 | chef-solo -f -c config.rb -j attributes.json | ||
| 36 | #Restart services | ||
| 37 | bash run-postinsts /etc/%POSTINSTS_DIR%/ | ||
diff --git a/meta-openstack/recipes-support/deploychef/files/run-postinsts b/meta-openstack/recipes-support/deploychef/files/run-postinsts new file mode 100644 index 0000000..35d46f0 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/run-postinsts | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # run-postinsts | ||
| 3 | # | ||
| 4 | # Copyright (c) 2014 Wind River Systems, Inc. | ||
| 5 | # | ||
| 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 7 | # of this software and associated documentation files (the "Software"), to deal | ||
| 8 | # in the Software without restriction, including without limitation the rights | ||
| 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 10 | # copies of the Software, and to permit persons to whom the Software is | ||
| 11 | # furnished to do so, subject to the following conditions: | ||
| 12 | # | ||
| 13 | # The above copyright notice and this permission notice shall be included in | ||
| 14 | # all copies or substantial portions of the Software. | ||
| 15 | |||
| 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 22 | # THE SOFTWARE. | ||
| 23 | # | ||
| 24 | # After chefsolo generates our config and scripts, we call this script | ||
| 25 | # to run the posinstall script and start the services | ||
| 26 | # | ||
| 27 | # | ||
| 28 | RPM_POSTINSTS_DIR=$1 | ||
| 29 | LOG_DIR='/var/log/%PACKAGE_NAME%/' | ||
| 30 | mkdir -p $LOG_DIR | ||
| 31 | if [ ! -d $RPM_POSTINSTS_DIR ]; then | ||
| 32 | echo "Post Install script dir not set" | ||
| 33 | exit 1 | ||
| 34 | fi | ||
| 35 | cd / #work-around for cinder-volume config file location | ||
| 36 | echo "x$RPM_POSTINSTS_DIR" > "$LOD_DIR"log.run-postinsts | ||
| 37 | for i in `ls $RPM_POSTINSTS_DIR 2> /dev/null`; do | ||
| 38 | i=$RPM_POSTINSTS_DIR$i | ||
| 39 | echo "Running postinst $i..." | ||
| 40 | if [ -f $i ] && $i; then | ||
| 41 | rm $i | ||
| 42 | else | ||
| 43 | echo "ERROR: postinst $i failed. $? " >> "$LOG_DIR"log.run-postinsts | ||
| 44 | fi | ||
| 45 | done | ||
| 46 | |||
| 47 | |||
| 48 | #Start all the modules specified in startup-list | ||
| 49 | INITD_DIR=/etc/init.d/ | ||
| 50 | services=$(cat %DEPLOYCHEF_ROOT_DIR%/startup-list) | ||
| 51 | for service in $services; do | ||
| 52 | service=$(echo $service | awk -F'S..' '{print $2}') | ||
| 53 | if [ -e $INITD_DIR$service ]; then | ||
| 54 | if [ $service = 'cinder-volume' ]; then | ||
| 55 | $INITD_DIR$service reload | ||
| 56 | else | ||
| 57 | $INITD_DIR$service start | ||
| 58 | fi | ||
| 59 | sleep 1 | ||
| 60 | fi | ||
| 61 | done | ||
| 62 | |||
| 63 | #Restart cloud service cloud-init | ||
| 64 | /etc/init.d/cloud-init start | ||
diff --git a/meta-openstack/recipes-support/deploychef/files/service-shutdown b/meta-openstack/recipes-support/deploychef/files/service-shutdown new file mode 100644 index 0000000..b89f9fa --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/service-shutdown | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # service-shutdown | ||
| 3 | # | ||
| 4 | # Copyright (c) 2014 Wind River Systems, Inc. | ||
| 5 | # | ||
| 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 7 | # of this software and associated documentation files (the "Software"), to deal | ||
| 8 | # in the Software without restriction, including without limitation the rights | ||
| 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 10 | # copies of the Software, and to permit persons to whom the Software is | ||
| 11 | # furnished to do so, subject to the following conditions: | ||
| 12 | # | ||
| 13 | # The above copyright notice and this permission notice shall be included in | ||
| 14 | # all copies or substantial portions of the Software. | ||
| 15 | |||
| 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 22 | # THE SOFTWARE. | ||
| 23 | # | ||
| 24 | # | ||
| 25 | INITD_DIR=/etc/init.d/ | ||
| 26 | services=$(cat %DEPLOYCHEF_ROOT_DIR%/shutdown-list) | ||
| 27 | for service in $services; do | ||
| 28 | service=$(echo $service | awk -F'K..' '{print $2}') | ||
| 29 | if [ -e $INITD_DIR$service ]; then | ||
| 30 | $INITD_DIR$service stop | ||
| 31 | sleep 1 | ||
| 32 | fi | ||
| 33 | done | ||
| 34 | |||
| 35 | #Clean up swift installation and all stale files | ||
| 36 | /etc/swift/swift_setup.sh clean | ||
| 37 | |||
| 38 | #Delete all the know data base entries | ||
| 39 | databases="ceilometer cinder glance heat keystone nova ovs_neutron \ | ||
| 40 | postgres" | ||
| 41 | for database in $databases; do | ||
| 42 | sudo -u postgres dropdb $database | ||
| 43 | sleep 1 | ||
| 44 | done | ||
| 45 | |||
| 46 | #Now shutdown postgres and database directory | ||
| 47 | if [ -e ${INITD_DIR}postgresql ]; then | ||
| 48 | ${INITD_DIR}postgresql stop | ||
| 49 | killall postgres | ||
| 50 | sleep 1 | ||
| 51 | rm -rf /etc/postgresql | ||
| 52 | sleep 1 | ||
| 53 | fi | ||
| 54 | |||
diff --git a/meta-openstack/recipes-support/deploychef/files/shutdown-list b/meta-openstack/recipes-support/deploychef/files/shutdown-list new file mode 100644 index 0000000..b1cda2e --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/shutdown-list | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | K10barbican-api | ||
| 2 | K10ceilometer-agent-central | ||
| 3 | K10ceilometer-agent-compute | ||
| 4 | K10ceilometer-alarm-evaluator | ||
| 5 | K10ceilometer-alarm-notifier | ||
| 6 | K10ceilometer-api | ||
| 7 | K10ceilometer-collector | ||
| 8 | K10cinder-api | ||
| 9 | K10cinder-backup | ||
| 10 | K10cinder-scheduler | ||
| 11 | K10cinder-volume | ||
| 12 | K10glance-api | ||
| 13 | K10glance-registry | ||
| 14 | K10heat-api | ||
| 15 | K10heat-api-cfn | ||
| 16 | K10heat-engine | ||
| 17 | K10horizon | ||
| 18 | K10keystone | ||
| 19 | K10neutron-dhcp-agent | ||
| 20 | K10neutron-l3-agent | ||
| 21 | K10neutron-openvswitch-agent | ||
| 22 | K10neutron-server | ||
| 23 | K10nova-api | ||
| 24 | K10nova-cert | ||
| 25 | K10nova-compute | ||
| 26 | K10nova-conductor | ||
| 27 | K10nova-consoleauth | ||
| 28 | K10nova-network | ||
| 29 | K10nova-novncproxy | ||
| 30 | K10nova-scheduler | ||
| 31 | K10nova-spicehtml5proxy | ||
| 32 | K20apache2 | ||
| 33 | K20cloud-init | ||
| 34 | K20dnsmasq | ||
| 35 | K20rabbitmq-server | ||
| 36 | K20swift | ||
| 37 | K80glusterd | ||
| 38 | K20postgresql | ||
| 39 | K50deploy | ||
| 40 | K71openvswitch-switch | ||
| 41 | K72libvirtd | ||
| 42 | |||
diff --git a/meta-openstack/recipes-support/deploychef/files/startup-list b/meta-openstack/recipes-support/deploychef/files/startup-list new file mode 100644 index 0000000..810d619 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/startup-list | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | S20cloud-init | ||
| 2 | S20dnsmasq | ||
| 3 | S20glusterd | ||
| 4 | S20postgresql | ||
| 5 | S20rabbitmq-server | ||
| 6 | S20swift | ||
| 7 | S30barbican-api | ||
| 8 | S30ceilometer-agent-central | ||
| 9 | S30ceilometer-agent-compute | ||
| 10 | S30ceilometer-alarm-evaluator | ||
| 11 | S30ceilometer-alarm-notifier | ||
| 12 | S30ceilometer-api | ||
| 13 | S30ceilometer-collector | ||
| 14 | S30cinder-volume | ||
| 15 | S30cinder-backup | ||
| 16 | S30cinder-scheduler | ||
| 17 | S30cinder-api | ||
| 18 | S30glance-api | ||
| 19 | S30glance-registry | ||
| 20 | S30heat-api | ||
| 21 | S30heat-api-cfn | ||
| 22 | S30heat-engine | ||
| 23 | S30horizon | ||
| 24 | S30keystone | ||
| 25 | S30neutron-dhcp-agent | ||
| 26 | S30neutron-l3-agent | ||
| 27 | S30neutron-openvswitch-agent | ||
| 28 | S30neutron-server | ||
| 29 | S30nova-api | ||
| 30 | S30nova-cert | ||
| 31 | S30nova-compute | ||
| 32 | S30nova-conductor | ||
| 33 | S30nova-consoleauth | ||
| 34 | S30nova-network | ||
| 35 | S30nova-novncproxy | ||
| 36 | S30nova-scheduler | ||
| 37 | S30nova-spicehtml5proxy | ||
| 38 | S70lighttpd | ||
| 39 | S71openvswitch-switch | ||
| 40 | S72libvirtd | ||
| 41 | S72openvswitch-controller | ||
