From fbd0ed9390fa58be2cc7f09a46d3c3789fd63bef Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:42:19 -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 %}