Debian Codegraph @

ansible_collections/community/crypto/tests/integration/targets/prepare_http_tests/tasks/default.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - name: RedHat - Enable the dynamic CA configuration feature (RHEL up to 9)
7 ansible.builtin.command: update-ca-trust force-enable
8 when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution != "Fedora" and (ansible_facts.distribution_major_version | int) < 10
9
10 - name: RedHat - Enable the dynamic CA configuration feature (RHEL 10+)
11 ansible.builtin.command: update-ca-trust
12 when: ansible_facts.os_family == 'RedHat' and ansible_facts.distribution != "Fedora" and (ansible_facts.distribution_major_version | int) >= 10
13
14 - name: RedHat - Retrieve test cacert
15 ansible.builtin.get_url:
16 url: "http://ansible.http.tests/cacert.pem"
17 dest: "/etc/pki/ca-trust/source/anchors/ansible.pem"
18 when: ansible_facts.os_family == 'RedHat'
19
20 - name: Get client cert/key
21 ansible.builtin.get_url:
22 url: "http://ansible.http.tests/{{ item }}"
23 dest: "{{ remote_tmp_dir }}/{{ item }}"
24 with_items:
25 - client.pem
26 - client.key
27
28 - name: Suse - Retrieve test cacert
29 ansible.builtin.get_url:
30 url: "http://ansible.http.tests/cacert.pem"
31 dest: "/etc/pki/trust/anchors/ansible.pem"
32 when: ansible_facts.os_family == 'Suse'
33
34 - name: Debian - Retrieve test cacert
35 ansible.builtin.get_url:
36 url: "http://ansible.http.tests/cacert.pem"
37 dest: "/usr/local/share/ca-certificates/ansible.crt"
38 when: ansible_facts.os_family == 'Debian'
39
40 - name: Redhat - Update ca trust
41 ansible.builtin.command: update-ca-trust extract
42 when: ansible_facts.os_family == 'RedHat'
43
44 - name: Debian/Suse - Update ca certificates
45 ansible.builtin.command: update-ca-certificates
46 when: ansible_facts.os_family == 'Debian' or ansible_facts.os_family == 'Suse'
47
48 - name: FreeBSD - Retrieve test cacert
49 ansible.builtin.get_url:
50 url: "http://ansible.http.tests/cacert.pem"
51 dest: "/tmp/ansible.pem"
52 when: ansible_facts.os_family == 'FreeBSD'
53
54 - name: FreeBSD - Read test cacert
55 ansible.builtin.slurp:
56 src: "/tmp/ansible.pem"
57 register: slurp
58 when: ansible_facts.os_family == 'FreeBSD'
59
60 - name: FreeBSD - Add cacert to root certificate store
61 ansible.builtin.blockinfile:
62 path: "/etc/ssl/cert.pem"
63 block: "{{ slurp.content | b64decode }}"
64 when: ansible_facts.os_family == 'FreeBSD'
65
66 - name: MacOS - Retrieve test cacert
67 when: ansible_facts.os_family == 'Darwin'
68 block:
69 - ansible.builtin.uri:
70 url: "http://ansible.http.tests/cacert.pem"
71 return_content: true
72 register: cacert_pem
73
74 - ansible.builtin.raw: '{{ ansible_python_interpreter }} -c "import ssl; print(ssl.get_default_verify_paths().cafile)"'
75 register: macos_cafile
76
77 - ansible.builtin.blockinfile:
78 path: "{{ macos_cafile.stdout_lines | first }}"
79 block: "{{ cacert_pem.content }}"