1139b8a18f
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
43 lines
1.6 KiB
YAML
43 lines
1.6 KiB
YAML
---
|
|
# Copyright 2021, BBC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Slurp up CA certificates from pki setup host ({{ pki_setup_host }})
|
|
delegate_to: "{{ pki_setup_host }}"
|
|
slurp:
|
|
src: "{{ item.src | default(pki_dir ~ '/roots/' ~ item.name ~ '/certs/' ~ item.name ~ '.crt') }}"
|
|
register: _ca_slurp
|
|
run_once: true
|
|
loop: "{{ _pki_install_ca_defs }}"
|
|
ignore_errors: "{{ ansible_check_mode }}"
|
|
|
|
- name: Copy CA certificates to target host
|
|
copy:
|
|
content: "{{ item.content | b64decode }}"
|
|
dest: "{{ pki_trust_store_location[ansible_facts['pkg_mgr']] }}/{{ item.item.filename | default(item.item.name ~ '.crt') }}"
|
|
register: ca_copy
|
|
loop: "{{ _ca_slurp.results | default([]) }}"
|
|
loop_control:
|
|
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 }}"
|
|
|
|
- name: Update CA store
|
|
command: "{{ pki_ca_install_command[ansible_facts['pkg_mgr']] }}"
|
|
when:
|
|
- ca_copy is changed
|