Debian Codegraph @

ansible_collections/community/crypto/tests/integration/targets/openssl_privatekey/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 - name: Find out which elliptic curves are supported by installed OpenSSL
12 ansible.builtin.command: "{{ openssl_binary }} ecparam -list_curves"
13 register: openssl_ecc
14
15 - name: Compile list of elliptic curves supported by OpenSSL
16 ansible.builtin.set_fact:
17 openssl_ecc_list: |
18 {{
19 openssl_ecc.stdout_lines
20 | map('regex_search', '^ *([a-zA-Z0-9_-]+) *: .*$')
21 | select()
22 | map('regex_replace', '^ *([a-zA-Z0-9_-]+) *: .*$', '\1')
23 | list
24 }}
25 when: ansible_facts.distribution != 'CentOS' or ansible_facts.distribution_major_version != '6'
26 # CentOS comes with a very old jinja2 which does not include the map() filter...
27 - name: Compile list of elliptic curves supported by OpenSSL (CentOS 6)
28 ansible.builtin.set_fact:
29 openssl_ecc_list:
30 - secp384r1
31 - secp521r1
32 - prime256v1
33 when: ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version == '6'
34
35 - name: List of elliptic curves supported by OpenSSL
36 ansible.builtin.debug: var=openssl_ecc_list
37
38 - name: Run module with backend autodetection
39 community.crypto.openssl_privatekey:
40 path: '{{ remote_tmp_dir }}/privatekey_backend_selection.pem'
41 size: '{{ default_rsa_key_size }}'
42
43 - block:
44 - name: Running tests with cryptography backend
45 ansible.builtin.include_tasks: impl.yml
46 vars:
47 select_crypto_backend: cryptography
48
49 - ansible.builtin.import_tasks: ../tests/validate.yml
50 vars:
51 select_crypto_backend: cryptography
52
53 when: cryptography_version is version('3.3', '>=')