Debian Codegraph @

ansible_collections/community/crypto/tests/integration/targets/x509_certificate_info/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: Make sure the Python idna library is installed
12 ansible.builtin.pip:
13 name: idna
14 state: present
15
16 - name: Generate privatekey
17 community.crypto.openssl_privatekey:
18 path: '{{ remote_tmp_dir }}/privatekey.pem'
19 size: '{{ default_rsa_key_size_certificates }}'
20
21 - name: Generate privatekey with password
22 community.crypto.openssl_privatekey:
23 path: '{{ remote_tmp_dir }}/privatekeypw.pem'
24 passphrase: hunter2
25 select_crypto_backend: cryptography
26 size: '{{ default_rsa_key_size_certificates }}'
27
28 - name: Generate CSR 1
29 community.crypto.openssl_csr:
30 path: '{{ remote_tmp_dir }}/csr_1.csr'
31 privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
32 subject:
33 commonName: www.example.com
34 C: de
35 L: Somewhere
36 ST: Zurich
37 streetAddress: Welcome Street
38 O: Ansible
39 organizationalUnitName:
40 - Crypto Department
41 - ACME Department
42 serialNumber: "1234"
43 SN: Last Name
44 GN: First Name
45 title: Chief
46 pseudonym: test
47 UID: asdf
48 emailAddress: [email protected]
49 postalAddress: 1234 Somewhere
50 postalCode: "1234"
51 useCommonNameForSAN: false
52 key_usage:
53 - digitalSignature
54 - keyAgreement
55 - Non Repudiation
56 - Key Encipherment
57 - dataEncipherment
58 - Certificate Sign
59 - cRLSign
60 - Encipher Only
61 - decipherOnly
62 key_usage_critical: true
63 extended_key_usage:
64 - serverAuth # the same as "TLS Web Server Authentication"
65 - TLS Web Server Authentication
66 - TLS Web Client Authentication
67 - Code Signing
68 - E-mail Protection
69 - timeStamping
70 - OCSPSigning
71 - Any Extended Key Usage
72 - qcStatements
73 - DVCS
74 - IPSec User
75 - biometricInfo
76 subject_alt_name:
77 - "DNS:www.ansible.com"
78 - "DNS:öç.com"
79 # cryptography < 2.1 cannot handle certain Unicode characters
80 - "DNS:☺.com"
81 - "IP:1.2.3.4"
82 - "IP:::1"
83 - "email:[email protected]"
84 - "URI:https://example.org/test/index.html"
85 basic_constraints:
86 - "CA:TRUE"
87 - "pathlen:23"
88 basic_constraints_critical: true
89 ocsp_must_staple: true
90 subject_key_identifier: "00:11:22:33"
91 authority_key_identifier: "44:55:66:77"
92 authority_cert_issuer: '{{ value_for_authority_cert_issuer }}'
93 authority_cert_serial_number: 12345
94 vars:
95 value_for_authority_cert_issuer:
96 - "DNS:ca.example.org"
97 - "IP:1.2.3.4"
98
99 - name: Generate CSR 2
100 community.crypto.openssl_csr:
101 path: '{{ remote_tmp_dir }}/csr_2.csr'
102 privatekey_path: '{{ remote_tmp_dir }}/privatekeypw.pem'
103 privatekey_passphrase: hunter2
104 useCommonNameForSAN: false
105 basic_constraints:
106 - "CA:TRUE"
107
108 - name: Generate CSR 3
109 community.crypto.openssl_csr:
110 path: '{{ remote_tmp_dir }}/csr_3.csr'
111 privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
112 useCommonNameForSAN: false
113 subject_alt_name:
114 - "DNS:*.ansible.com"
115 - "DNS:*.example.org"
116 - "IP:DEAD:BEEF::1"
117 basic_constraints:
118 - "CA:FALSE"
119 authority_cert_issuer: '{{ value_for_authority_cert_issuer }}'
120 authority_cert_serial_number: 12345
121 vars:
122 value_for_authority_cert_issuer:
123 - "DNS:ca.example.org"
124 - "IP:1.2.3.4"
125
126 - name: Generate CSR 4
127 community.crypto.openssl_csr:
128 path: '{{ remote_tmp_dir }}/csr_4.csr'
129 privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
130 useCommonNameForSAN: false
131 authority_key_identifier: "44:55:66:77"
132
133 - name: Generate selfsigned certificates
134 community.crypto.x509_certificate:
135 path: '{{ remote_tmp_dir }}/cert_{{ item }}.pem'
136 csr_path: '{{ remote_tmp_dir }}/csr_{{ item }}.csr'
137 privatekey_path: '{{ remote_tmp_dir }}/privatekey.pem'
138 provider: selfsigned
139 selfsigned_digest: sha256
140 selfsigned_not_after: "+10d"
141 selfsigned_not_before: "-3d"
142 loop:
143 - 1
144 - 2
145 - 3
146 - 4
147
148 - name: Running tests with cryptography backend
149 ansible.builtin.include_tasks: impl.yml
150 vars:
151 select_crypto_backend: cryptography
152 when: cryptography_version is version('3.3', '>=')