dynamically create port forwards from 'head_vm_hosts'
diff --git a/roles/juju-setup/tasks/main.yml b/roles/juju-setup/tasks/main.yml
index 6b7c25e..d1b2f30 100644
--- a/roles/juju-setup/tasks/main.yml
+++ b/roles/juju-setup/tasks/main.yml
@@ -31,6 +31,19 @@
- name: Verify that we can log into every VM
command: ansible services -m ping -u ubuntu
+- name: Have libvirt enable port forwarding to VM's
+ become: yes
+ template:
+ src={{ item }}.j2
+ dest=/etc/libvirt/hooks/{{ item }}
+ mode=0755 owner=root
+ with_items:
+ - daemon
+ - qemu
+ notify:
+ - reload libvirt-bin
+ - run qemu hook
+
- name: Initialize Juju
command: juju generate-config
creates={{ ansible_user_dir }}/.juju/environments.yaml
@@ -77,7 +90,6 @@
# 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
@@ -85,19 +97,10 @@
- "{{ service_relations }}"
- relations
-# Need to wait for services to come up here
-# Possibly do so by using wait_for and wating on forwarded ports after next step?
-
-- name: Have libvirt enable port forwarding to VM's
- become: yes
- copy:
- src={{ item }}
- dest=/etc/libvirt/hooks/{{ item }}
- mode=0755 owner=root
- with_items:
- - daemon
- - qemu
- notify:
- - reload libvirt-bin
- - run qemu hook
+# This should be able to test for the VM's coming up, but not working right now
+#- name: Wait for juju services on VM's to come up
+# wait_for:
+# port={{ item.ext }}
+# timeout=10
+# with_items: "{{ head_vm_list | map(attribute='forwarded_ports') | reject('undefined') | list }}"