From 2320f50621907612d4e131274d2fe7771c79168e Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 11 Jun 2019 16:37:44 -0400 Subject: [PATCH] Improve handling around loop var and correct pvcd --- roles/pvc/tasks/main.yml | 4 +++- roles/pvc/templates/pvc/pvcd.yaml.j2 | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/roles/pvc/tasks/main.yml b/roles/pvc/tasks/main.yml index 509d221..692f6e8 100644 --- a/roles/pvc/tasks/main.yml +++ b/roles/pvc/tasks/main.yml @@ -26,5 +26,7 @@ - include: pvc.yml tags: pvc-pvc run_once: true - delegate_to: "{{ item }}" + delegate_to: "{{ play_host }}" with_items: "{{ play_hosts }}" + loop_control: + loop_var: play_host diff --git a/roles/pvc/templates/pvc/pvcd.yaml.j2 b/roles/pvc/templates/pvc/pvcd.yaml.j2 index 515e923..2104d16 100644 --- a/roles/pvc/templates/pvc/pvcd.yaml.j2 +++ b/roles/pvc/templates/pvc/pvcd.yaml.j2 @@ -68,8 +68,9 @@ pvc: storage: {{ pvc_storage_device }} upstream: {{ pvc_upstream_device }} addresses: - cluster: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.cluster_ip }}{% endfor %} + cluster: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.cluster_ip }}/{{ node.cluster_cidr }}{% endfor %} - storage: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.storage_ip }}{% endfor %} + storage: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.storage_ip }}/{{ node.storage_cidr }}{% endfor %} + + upstream: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.upstream_ip }}/{{ node.upstream_cidr }}{% endfor %} - upstream: {% for node in pvc_nodes if node.hostname == ansible_hostname %}{{ node.upstream_ip }}{% endfor %}