blob: 31aeae39b431d92cf8650c62fed553d59eb8d55d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
---
- name: create base directory for root ca
file:
path: "/usr/local/share/ca-certificates/{{ x509_root_ca_name }}"
state: directory
- name: copy certificates for ca
loop: "{{ x509_root_ca_certificates | dict2items }}"
loop_control:
label: "{{ item.key }}"
copy:
src: "{{ item.value.file | default(omit) }}"
content: "{{ item.value.content | default(omit) }}"
dest: "/usr/local/share/ca-certificates/{{ x509_root_ca_name }}/{{ item.key }}.crt"
notify: update ca certificates
- name: fetch list of currently installed certificates
find:
paths: "/usr/local/share/ca-certificates/{{ x509_root_ca_name }}"
patterns: "*.crt"
register: x509_root_ca_certificates_installed
- name: remove superflous certificates
loop: "{{ x509_root_ca_certificates_installed.files | map(attribute='path') | map('basename') | map('splitext') | map('first') | difference(x509_root_ca_certificates | list) }}"
file:
path: "/usr/local/share/ca-certificates/{{ x509_root_ca_name }}/{{ item }}.crt"
state: absent
notify: update ca certificates fresh
|