From 9f9e532591dec8c0214c50e29050896e659fc553 Mon Sep 17 00:00:00 2001 From: John Fulton Date: Fri, 22 Sep 2023 15:05:50 -0400 Subject: [PATCH] edpm_libvirt role should handle quoted cephx keys It's valid for the key inside a ceph keyring file to be either quoted or not quoted. Before this patch, if the key was quoted, then it was not passed to the "virsh secret-set-value" command because it did not satisfy the regex check because of the quotes. This change strips the quotes from the key value before it is checked and passed to the virsh command. Signed-off-by: John Fulton --- roles/edpm_libvirt/tasks/virsh-secret.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/edpm_libvirt/tasks/virsh-secret.yml b/roles/edpm_libvirt/tasks/virsh-secret.yml index e051da996..3d86c128c 100644 --- a/roles/edpm_libvirt/tasks/virsh-secret.yml +++ b/roles/edpm_libvirt/tasks/virsh-secret.yml @@ -35,7 +35,7 @@ ansible.builtin.command: "podman exec libvirt_virtqemud bash -c 'virsh secret-set-value $FSID --base64 $KEY'" environment: FSID: "{{ fsid }}" - KEY: "{{ cephx_key.stdout }}" + KEY: "{{ cephx_key.stdout | regex_replace('\"', '') }}" when: - cephx_key.stdout is defined - - cephx_key.stdout | regex_search('^[a-zA-Z0-9+/]{38}==$') + - cephx_key.stdout | regex_replace('\"', '') | regex_search('^[a-zA-Z0-9+/]{38}==$')