Debian Codegraph @

ansible_collections/community/crypto/tests/integration/targets/get_certificate/tasks/main.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 ####################################################################
7 # WARNING: These are designed specifically for Ansible tests #
8 # and should not be used as examples of how to write Ansible roles #
9 ####################################################################
10
11 - ansible.builtin.set_fact:
12 skip_tests: false
13 has_get_certificate_chain: >-
14 {{ ansible_facts.python_version is version('3.10.0', '>=') }}
15
16 - block:
17
18 - name: Get servers certificate with backend auto-detection
19 community.crypto.get_certificate:
20 host: "{{ httpbin_host }}"
21 port: 443
22 asn1_base64: "{{ true if ansible_version.full is version('2.18', '>=') else omit }}"
23 ignore_errors: true
24 register: result
25
26 - ansible.builtin.set_fact:
27 skip_tests: |
28 {{
29 result is failed and (
30 'error: [Errno 1] _ssl.c:492: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure' in result.msg
31 or
32 'error: _ssl.c:314: Invalid SSL protocol variant specified.' in result.msg
33 )
34 }}
35
36 - ansible.builtin.assert:
37 that:
38 - result is success or skip_tests
39
40 when: cryptography_version is version('3.3', '>=')
41
42 - block:
43
44 - ansible.builtin.include_tasks: ../tests/validate.yml
45 vars:
46 select_crypto_backend: cryptography
47
48 # The module doesn't work with CentOS 6. Since the pyOpenSSL installed there is too old,
49 # we never noticed before. This becomes a problem with the new cryptography backend,
50 # since there is a new enough cryptography version...
51 when: cryptography_version is version('1.6', '>=') and not skip_tests