From f49fb599c134f296c95d1c40c4c95eef01a0802e Mon Sep 17 00:00:00 2001 From: Stephane Armanet <stephanearmanet@esss.lu.se> Date: Thu, 4 Feb 2021 12:43:09 +0100 Subject: [PATCH] add Ubuntu --- defaults/main.yml | 2 ++ handlers/main.yml | 2 +- molecule/default/molecule.yml | 4 ++++ tasks/main.yml | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index f19f292..aec7609 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,4 @@ --- ca_trust_certificates: [] +ca_trust_cert_path: "{{ '/etc/pki/ca-trust/source/anchors/' if ansible_os_family == 'RedHat' else '/usr/local/share/ca-certificates' }}" +ca_trust_update_ca_cmd: "{{ 'update-ca-trust' if ansible_os_family == 'RedHat' else 'update-ca-certificates' }}" diff --git a/handlers/main.yml b/handlers/main.yml index 414129d..2dc83a4 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,3 +1,3 @@ --- - name: Update CA trust - command: update-ca-trust + command: "{{ ca_trust_update_ca_cmd }}" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 414889c..5e6c2ce 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -47,3 +47,7 @@ platforms: image: centos:7 groups: - molecule_group + - name: ca-trust-ubuntu + image: ubuntu:20.04 + groups: + - molecule_group diff --git a/tasks/main.yml b/tasks/main.yml index 9e09362..aa0bf04 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,12 +1,12 @@ --- - name: Install ca-certificates - yum: + package: name: ca-certificates - name: Add certificates to trust store copy: content: "{{ item.certificate }}" - dest: "/etc/pki/ca-trust/source/anchors/{{ item.name }}.crt" + dest: "{{ ca_trust_cert_path }}/{{ item.name }}.crt" owner: root group: root mode: 0644 -- GitLab