Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | import subprocess |
| 4 | import time |
| 5 | import argparse |
| 6 | |
| 7 | sleep_interval = 1 |
| 8 | |
| 9 | relations = ["keystone mysql", |
| 10 | "nova-cloud-controller mysql", |
| 11 | "nova-cloud-controller rabbitmq-server", |
| 12 | "nova-cloud-controller glance", |
| 13 | "nova-cloud-controller keystone", |
| 14 | "glance mysql", |
| 15 | "glance keystone", |
Andy Bavier | 093e6a8 | 2015-08-21 13:31:31 -0400 | [diff] [blame] | 16 | "neutron-gateway neutron-api", |
| 17 | "neutron-gateway:amqp rabbitmq-server:amqp", |
| 18 | "neutron-gateway nova-cloud-controller", |
| 19 | "neutron-gateway mysql", |
| 20 | "neutron-api keystone", |
| 21 | "neutron-api neutron-openvswitch", |
| 22 | "neutron-api mysql", |
| 23 | "neutron-api rabbitmq-server", |
| 24 | "neutron-api nova-cloud-controller", |
| 25 | "neutron-openvswitch rabbitmq-server", |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 26 | "openstack-dashboard keystone", |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 27 | "mysql nagios", |
| 28 | "rabbitmq-server nagios", |
| 29 | "keystone nagios", |
| 30 | "glance nagios", |
| 31 | "nova-cloud-controller nagios", |
Andy Bavier | 093e6a8 | 2015-08-21 13:31:31 -0400 | [diff] [blame] | 32 | "neutron-gateway nagios", |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 33 | "openstack-dashboard nagios", |
Andy Bavier | 7444748 | 2015-08-27 13:16:17 -0400 | [diff] [blame] | 34 | "neutron-api nagios", |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 35 | "nagios nrpe", |
Andy Bavier | 7444748 | 2015-08-27 13:16:17 -0400 | [diff] [blame] | 36 | "mysql:juju-info nrpe:general-info", |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 37 | "rabbitmq-server nrpe", |
| 38 | "keystone nrpe", |
| 39 | "glance nrpe", |
| 40 | "nova-cloud-controller nrpe", |
Andy Bavier | 093e6a8 | 2015-08-21 13:31:31 -0400 | [diff] [blame] | 41 | "neutron-gateway nrpe", |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 42 | "openstack-dashboard nrpe", |
Andy Bavier | 7444748 | 2015-08-27 13:16:17 -0400 | [diff] [blame] | 43 | "neutron-api nrpe", |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 44 | "ceilometer mongodb", |
| 45 | "ceilometer rabbitmq-server", |
| 46 | "ceilometer:identity-service keystone:identity-service", |
| 47 | "ceilometer:ceilometer-service ceilometer-agent:ceilometer-service", |
| 48 | "ceilometer nagios", |
| 49 | "ceilometer nrpe", |
| 50 | ] |
| 51 | |
| 52 | def addrelation(relation): |
| 53 | subprocess.check_call("juju add-relation %s" % relation, shell=True) |
| 54 | |
| 55 | def destroyrelation(relation): |
| 56 | subprocess.check_call("juju destroy-relation %s" % relation, shell=True) |
| 57 | |
| 58 | def addrelations(): |
| 59 | for relation in relations: |
| 60 | print "Adding relation %s" % relation |
| 61 | try: |
| 62 | addrelation(relation) |
| 63 | time.sleep(sleep_interval) |
| 64 | except: |
| 65 | pass |
Andy Bavier | 093e6a8 | 2015-08-21 13:31:31 -0400 | [diff] [blame] | 66 | |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 67 | def destroyrelations(): |
| 68 | for relation in relations: |
| 69 | print "Destroying relation %s" % relation |
| 70 | try: |
| 71 | destroyrelation(relation) |
| 72 | time.sleep(sleep_interval) |
| 73 | except: |
| 74 | pass |
| 75 | |
| 76 | def main(): |
| 77 | parser = argparse.ArgumentParser(description='Deploy OpenStack controller services') |
| 78 | parser.add_argument('--destroy', action='store_true', |
| 79 | help='Destroy the relations instead of adding them') |
| 80 | |
| 81 | args = parser.parse_args() |
| 82 | if args.destroy: |
| 83 | destroyrelations() |
| 84 | else: |
| 85 | addrelations() |
Andy Bavier | 093e6a8 | 2015-08-21 13:31:31 -0400 | [diff] [blame] | 86 | |
Andy Bavier | 8d51c6c | 2015-04-01 11:40:22 -0400 | [diff] [blame] | 87 | if __name__ =='__main__': |
| 88 | main() |