blob: 9c4b1f7ae80942f00464dc105fcc3a7804453062 [file] [log] [blame]
Andy Bavier8d51c6c2015-04-01 11:40:22 -04001#!/usr/bin/python
2
3import subprocess
4import time
5import argparse
6
7sleep_interval = 1
8
9relations = ["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 Bavier093e6a82015-08-21 13:31:31 -040016 "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 Bavier8d51c6c2015-04-01 11:40:22 -040026 "openstack-dashboard keystone",
Andy Bavierd268b452015-09-22 18:22:23 -040027# "mysql nagios",
28# "rabbitmq-server nagios",
29# "keystone nagios",
30# "glance nagios",
31# "nova-cloud-controller nagios",
32# "neutron-gateway nagios",
33# "openstack-dashboard nagios",
34# "neutron-api nagios",
Andy Bavier8d51c6c2015-04-01 11:40:22 -040035 "nagios nrpe",
Andy Bavier74447482015-08-27 13:16:17 -040036 "mysql:juju-info nrpe:general-info",
Andy Bavier8d51c6c2015-04-01 11:40:22 -040037 "rabbitmq-server nrpe",
38 "keystone nrpe",
39 "glance nrpe",
40 "nova-cloud-controller nrpe",
Andy Bavier093e6a82015-08-21 13:31:31 -040041 "neutron-gateway nrpe",
Andy Bavier8d51c6c2015-04-01 11:40:22 -040042 "openstack-dashboard nrpe",
Andy Bavier74447482015-08-27 13:16:17 -040043 "neutron-api nrpe",
Andy Bavier8d51c6c2015-04-01 11:40:22 -040044 "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
52def addrelation(relation):
53 subprocess.check_call("juju add-relation %s" % relation, shell=True)
54
55def destroyrelation(relation):
56 subprocess.check_call("juju destroy-relation %s" % relation, shell=True)
57
58def 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 Bavier093e6a82015-08-21 13:31:31 -040066
Andy Bavier8d51c6c2015-04-01 11:40:22 -040067def 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
76def 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 Bavier093e6a82015-08-21 13:31:31 -040086
Andy Bavier8d51c6c2015-04-01 11:40:22 -040087if __name__ =='__main__':
88 main()