Files
ansible-role-pki/tasks/standalone/install_ca.yml
Damian Dabrowski 7d35268e1d Separate backend-specific logic to improve extensibility
Although the role is intended to support multiple backends, in practice
it was tightly coupled with the standalone backend. Several tasks in the
"generic" parts were specific to the standalone case, and the
distinction between global and backend-specific variables was unclear.

This patch improves the separation between generic and backend-specific
logic, making it easier to add and maintain additional backends in the
future.

Change-Id: I9124c85099e1338c2cb2dcef971475eaf3a5860d
Signed-off-by: Damian Dabrowski <damian.dabrowski@cleura.com>
2025-09-25 21:03:28 +02:00

35 lines
1.3 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 }}"
ansible.builtin.slurp:
src: "{{ ca.src | default(pki_dir ~ '/roots/' ~ ca.name ~ '/certs/' ~ ca.name ~ '.crt') }}"
register: _ca_slurp
run_once: true
ignore_errors: "{{ ansible_check_mode }}"
- name: Copy CA certificates to target host
ansible.builtin.copy:
content: "{{ _ca_slurp.content | b64decode }}"
dest: "{{ pki_trust_store_location[ansible_facts['pkg_mgr']] }}/{{ ca.filename | default(ca.name ~ '.crt') }}"
register: ca_copy
ignore_errors: "{{ ansible_check_mode }}"
- name: Update CA store
ansible.builtin.command: "{{ pki_ca_install_command[ansible_facts['pkg_mgr']] }}"
when:
- ca_copy is changed