From 1139b8a18f17b1c0755e579e23cc68b6f9be5aaf Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 30 Jun 2023 14:49:53 +0200 Subject: [PATCH] Convert loop labels to strings Since ansible-core 2.15 it's a requirement to have loop labels as strings. In order to remain code readable, we move definition of label to vars and convert them to json string for output. Change-Id: I453d2db4eeefb78735db54cf9e6fa8fa5f89b069 --- tasks/main_certs.yml | 8 ++++++-- tasks/standalone/install_ca.yml | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tasks/main_certs.yml b/tasks/main_certs.yml index 2f78b0c..57fa16a 100644 --- a/tasks/main_certs.yml +++ b/tasks/main_certs.yml @@ -56,7 +56,9 @@ loop: "{{ _cert_slurp.results }}" loop_control: loop_var: install - label: + label: "{{ loop_label | to_json }}" + vars: + loop_label: path: "{{ install.item.dest | dirname }}" state: directory mode: '0755' @@ -71,7 +73,9 @@ loop: "{{ _cert_slurp.results }}" loop_control: loop_var: install - label: + label: "{{ loop_label | to_json }}" + vars: + loop_label: dest: "{{ install.item.dest }}" owner: "{{ install.item.owner | default(omit) }}" group: "{{ install.item.group | default('omit') }}" diff --git a/tasks/standalone/install_ca.yml b/tasks/standalone/install_ca.yml index 9e4146f..a1c2288 100644 --- a/tasks/standalone/install_ca.yml +++ b/tasks/standalone/install_ca.yml @@ -29,7 +29,9 @@ register: ca_copy loop: "{{ _ca_slurp.results | default([]) }}" loop_control: - label: + label: "{{ loop_label | to_json }}" + vars: + loop_label: dest: "{{ pki_trust_store_location[ansible_facts['pkg_mgr']] }}/{{ item.item.filename | default(item.item.name ~ '.crt') }}" when: item.skipped is not defined ignore_errors: "{{ ansible_check_mode }}"