Debian Codegraph @

ansible_collections/community/crypto/tests/integration/targets/openssl_privatekey_convert/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: Determine capabilities
12 ansible.builtin.set_fact:
13 supports_ed25519: >-
14 {{
15 not (
16 ansible_facts.os_family == "FreeBSD" and
17 ansible_facts.distribution_version is version("12.1", ">=") and
18 ansible_facts.distribution_version is version("12.2", "<")
19 )
20 }}
21
22 - name: Create keys
23 community.crypto.openssl_privatekey:
24 size: '{{ item.size | default(omit) }}'
25 path: '{{ remote_tmp_dir }}/privatekey_{{ item.name }}.pem'
26 type: '{{ item.type | default(omit) }}'
27 curve: '{{ item.curve | default(omit) }}'
28 passphrase: '{{ item.passphrase | default(omit) }}'
29 format: '{{ item.format }}'
30 when: item.condition | default(true)
31 loop:
32 - name: rsa_pass1
33 format: pkcs1
34 type: RSA
35 size: '{{ default_rsa_key_size }}'
36 passphrase: secret
37 - name: ed25519
38 format: pkcs8
39 type: Ed25519
40 size: '{{ default_rsa_key_size }}'
41 condition: '{{ supports_ed25519 }}'
42 - name: x25519
43 format: pkcs8
44 type: X25519
45 size: '{{ default_rsa_key_size }}'
46
47 - name: Run module with backend autodetection
48 community.crypto.openssl_privatekey_convert:
49 src_path: '{{ remote_tmp_dir }}/privatekey_rsa_pass1.pem'
50 src_passphrase: secret
51 dest_path: '{{ remote_tmp_dir }}/output_backend_selection.pem'
52 dest_passphrase: hunter2
53 format: pkcs8
54
55 - block:
56 - name: Running tests with cryptography backend
57 ansible.builtin.include_tasks: impl.yml
58 vars:
59 select_crypto_backend: cryptography
60
61 when: cryptography_version is version('3.3', '>=')