compat with Ansible 2.0, added service_relations
diff --git a/roles/juju-setup/defaults/main.yml b/roles/juju-setup/defaults/main.yml
index 8087b54..d4f77a1 100644
--- a/roles/juju-setup/defaults/main.yml
+++ b/roles/juju-setup/defaults/main.yml
@@ -1,6 +1,9 @@
---
# roles/juju-setup/defaults/main.yml
+openstack_version: kilo
+openstack_cfg_path: /usr/local/src/openstack.cfg
+
head_vm_list:
- { name: "juju", cpu: "1", memMB: "2048", diskGB: "20" }
- { name: "ceilometer", cpu: "1", memMB: "2048", diskGB: "20" }
@@ -17,14 +20,14 @@
vm_service_list:
- ceilometer
- glance
- - keystone
+ - keystone
- mysql
- nagios
- neutron-api
- neutron-gateway
- nova-cloud-controller
- openstack-dashboard
- - rabbitmq-server
+ - rabbitmq-server
standalone_service_list:
- ntp
@@ -33,10 +36,32 @@
- neutron-openvswitch
service_relations:
- - keystone: [ "mysql" ]
- - nova-cloud-controller: [ "mysql", "rabbitmq-server", "glance", "keystone" ]
-
-openstack_version: kilo
-openstack_cfg_path: /usr/local/src/openstack.cfg
-
+ - name: keystone
+ relations: [ "mysql", "nrpe", ]
+ - name: nova-cloud-controller
+ relations: [ "mysql", "rabbitmq-server", "glance", "keystone", "nrpe", ]
+ - name: glance
+ relations: [ "mysql", "keystone", "nrpe", ]
+ - name: neutron-gateway
+ relations: [ "neutron-api", "nova-cloud-controller", "mysql", "nrpe", ]
+ - name: "neutron-gateway:amqp"
+ relations: [ "rabbitmq-server:amqp", ]
+ - name: neutron-api
+ relations: [ "keystone", "neutron-openvswitch", "mysql", "rabbitmq-server", "nova-cloud-controller", "nrpe", ]
+ - name: neutron-openvswitch
+ relations: [ "rabbitmq-server", ]
+ - name: openstack-dashboard
+ relations: [ "keystone", "nrpe", ]
+ - name: nagios
+ relations: [ "nrpe", ]
+ - name: "mysql:juju-info"
+ relations: [ "nrpe:general-info", ]
+ - name: rabbitmq-server
+ relations: [ "nrpe", ]
+ - name: ceilometer
+ relations: [ "mongodb", "rabbitmq-server", "nagios", "nrpe", ]
+ - name: "ceilometer:identity-service"
+ relations: [ "keystone:identity-service", ]
+ - name: "ceilometer:ceilometer-service"
+ relations: [ "ceilometer-agent:ceilometer-service", ]
diff --git a/roles/juju-setup/tasks/main.yml b/roles/juju-setup/tasks/main.yml
index bf40c73..7935fe3 100644
--- a/roles/juju-setup/tasks/main.yml
+++ b/roles/juju-setup/tasks/main.yml
@@ -5,11 +5,11 @@
shell: uvt-kvm create {{ item.name }} --cpu={{ item.cpu }} --memory={{ item.memMB }} --disk={{ item.diskGB }}; \
uvt-kvm wait --insecure {{ item.name }}
creates=/var/lib/uvtool/libvirt/images/{{ item.name }}.qcow
- with_items: head_vm_list
+ with_items: "{{ head_vm_list }}"
- name: discover VM IP addresses
- shell: uvt-kvm ip {{ item.name }}
- with_items: head_vm_list
+ shell: "uvt-kvm ip {{ item.name }}"
+ with_items: "{{ head_vm_list }}"
register: vm_ip
- name: Create /etc/hosts with VM IP addresses
@@ -71,3 +71,14 @@
command: "juju deploy {{ item }} --config={{ openstack_cfg_path }}"
with_items: "{{ standalone_service_list | difference( juju_services.keys() ) }}"
+# FIXME: ignoring errors when creating relationships.
+# Previous method wasn't idempotent either
+
+- name: Create relations between services
+ command: "juju add-relation '{{ item.0.name }}' '{{ item.1 }}'"
+ ignore_errors: True
+ with_subelements:
+ - "{{ service_relations }}"
+ - relations
+
+# Need to wait for services to come up here