Debian Codegraph @

test/integration/targets/module_utils_urls/tasks/main.yml

raw
1 - name: get peercert for HTTP connection
2 test_peercert:
3 url: http://{{ httpbin_host }}/get
4 register: cert_http
5
6 - name: assert get peercert for HTTP connection
7 assert:
8 that:
9 - cert_http.raw_cert == None
10
11 - name: get peercert for HTTPS connection
12 test_peercert:
13 url: https://{{ httpbin_host }}/get
14 register: cert_https
15
16 # Alpine does not have openssl, just make sure the text was actually set instead
17 - name: check if openssl is installed
18 command: which openssl
19 ignore_errors: yes
20 register: openssl
21
22 - name: get actual certificate from endpoint
23 shell: echo | openssl s_client -connect {{ httpbin_host }}:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
24 register: cert_https_actual
25 changed_when: no
26 when: openssl is successful
27
28 - name: assert get peercert for HTTPS connection
29 assert:
30 that:
31 - cert_https.raw_cert != None
32 - openssl is failed or cert_https.raw_cert == cert_https_actual.stdout_lines[1:-1] | join("")