From 4054d737dd4d0c0a5481a0dbf6573e9cb0c36e0c Mon Sep 17 00:00:00 2001 From: Marcus Klein Date: Thu, 15 Dec 2022 13:51:59 +0100 Subject: [PATCH] Use correct index of previous task results Change-Id: I450515395a510e40debfcdeb04fd98169a7a835e --- tasks/ceph_auth_extra_compute.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tasks/ceph_auth_extra_compute.yml b/tasks/ceph_auth_extra_compute.yml index cfc0970..36c2015 100644 --- a/tasks/ceph_auth_extra_compute.yml +++ b/tasks/ceph_auth_extra_compute.yml @@ -86,12 +86,14 @@ - name: Define libvirt nova extra secret(s) command: "virsh secret-define --file /tmp/{{ item.mon_host }}{{ item.client_name }}-secret.xml" changed_when: false - with_items: "{{ ceph_extra_confs }}" + loop: "{{ ceph_extra_confs }}" + loop_control: + index_var: index when: - - item.client_name is defined - - item.mon_host is defined - - item.secret_uuid is defined - - item.secret_uuid not in libvirt_secret_exists.results[0].stdout_lines + - "'client_name' in item" + - "'mon_host' in item" + - "'secret_uuid' in item" + - item.secret_uuid not in libvirt_secret_exists.results[index].stdout_lines notify: - Restart os services @@ -117,12 +119,14 @@ - name: Set extra secret value(s) in libvirt shell: "virsh secret-set-value --secret {{ item.secret_uuid }} --base64 $(cat /tmp/{{ item.mon_host }}{{ item.client_name }}.key.tmp)" - with_items: "{{ ceph_extra_confs }}" + loop: "{{ ceph_extra_confs }}" + loop_control: + index_var: index when: - - item.client_name is defined - - item.mon_host is defined - - item.secret_uuid is defined - - item.secret_uuid not in libvirt_secret_value_exists.results[0].stdout_lines + - "'client_name' in item" + - "'mon_host' in item" + - "'secret_uuid' in item" + - item.secret_uuid not in libvirt_secret_value_exists.results[index].stdout_lines notify: - Restart os services