Skip to content

Commit 56b29e3

Browse files
committed
Use return doc fragments.
1 parent e031dff commit 56b29e3

File tree

6 files changed

+99
-153
lines changed

6 files changed

+99
-153
lines changed

plugins/doc_fragments/_module_csr.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,60 @@ class ModuleDocFragment:
341341
- plugin: community.crypto.parse_serial
342342
plugin_type: filter
343343
"""
344+
345+
RETURN = r"""
346+
privatekey:
347+
description:
348+
- Path to the TLS/SSL private key the CSR was generated for.
349+
- Will be V(none) if the private key has been provided in O(privatekey_content).
350+
returned: changed or success
351+
type: str
352+
sample: /etc/ssl/private/ansible.com.pem
353+
subject:
354+
description: A list of the subject tuples attached to the CSR.
355+
returned: changed or success
356+
type: list
357+
elements: list
358+
sample: [['CN', 'www.ansible.com'], ['O', 'Ansible']]
359+
subjectAltName:
360+
description: The alternative names this CSR is valid for.
361+
returned: changed or success
362+
type: list
363+
elements: str
364+
sample: ['DNS:www.ansible.com', 'DNS:m.ansible.com']
365+
keyUsage:
366+
description: Purpose for which the public key may be used.
367+
returned: changed or success
368+
type: list
369+
elements: str
370+
sample: ['digitalSignature', 'keyAgreement']
371+
extendedKeyUsage:
372+
description: Additional restriction on the public key purposes.
373+
returned: changed or success
374+
type: list
375+
elements: str
376+
sample: ['clientAuth']
377+
basicConstraints:
378+
description: Indicates if the certificate belongs to a CA.
379+
returned: changed or success
380+
type: list
381+
elements: str
382+
sample: ['CA:TRUE', 'pathLenConstraint:0']
383+
ocsp_must_staple:
384+
description: Indicates whether the certificate has the OCSP Must Staple feature enabled.
385+
returned: changed or success
386+
type: bool
387+
sample: false
388+
name_constraints_permitted:
389+
description: List of permitted subtrees to sign certificates for.
390+
returned: changed or success
391+
type: list
392+
elements: str
393+
sample: ['email:.somedomain.com']
394+
name_constraints_excluded:
395+
description: List of excluded subtrees the CA cannot sign certificates for.
396+
returned: changed or success
397+
type: list
398+
elements: str
399+
sample: ['email:.com']
400+
"""

plugins/doc_fragments/_module_privatekey.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,33 @@ class ModuleDocFragment:
143143
- module: community.crypto.openssl_pkcs12
144144
- module: community.crypto.openssl_publickey
145145
"""
146+
147+
RETURN = r"""
148+
size:
149+
description: Size (in bits) of the TLS/SSL private key.
150+
returned: changed or success
151+
type: int
152+
sample: 4096
153+
type:
154+
description: Algorithm used to generate the TLS/SSL private key.
155+
returned: changed or success
156+
type: str
157+
sample: RSA
158+
curve:
159+
description: Elliptic curve used to generate the TLS/SSL private key.
160+
returned: changed or success, and O(type) is V(ECC)
161+
type: str
162+
sample: secp256r1
163+
fingerprint:
164+
description:
165+
- The fingerprint of the public key. Fingerprint will be generated for each C(hashlib.algorithms) available.
166+
returned: changed or success
167+
type: dict
168+
sample:
169+
md5: "84:75:71:72:8d:04:b5:6c:4d:37:6d:66:83:f5:4c:29"
170+
sha1: "51:cc:7c:68:5d:eb:41:43:88:7e:1a:ae:c7:f8:24:72:ee:71:f6:10"
171+
sha224: "b1:19:a6:6c:14:ac:33:1d:ed:18:50:d3:06:5c:b2:32:91:f1:f1:52:8c:cb:d5:75:e9:f5:9b:46"
172+
sha256: "41:ab:c7:cb:d5:5f:30:60:46:99:ac:d4:00:70:cf:a1:76:4f:24:5d:10:24:57:5d:51:6e:09:97:df:2f:de:c7"
173+
sha384: "85:39:50:4e:de:d9:19:33:40:70:ae:10:ab:59:24:19:51:c3:a2:e4:0b:1c:b1:6e:dd:b3:0c:d9:9e:6a:46:af:da:18:f8:ef:ae:2e:c0:9a:75:2c:9b:b3:0f:3a:5f:3d"
174+
sha512: "fd:ed:5e:39:48:5f:9f:fe:7f:25:06:3f:79:08:cd:ee:a5:e7:b3:3d:13:82:87:1f:84:e1:f5:c7:28:77:53:94:86:56:38:69:f0:d9:35:22:01:1e:a6:60:...:0f:9b"
175+
"""

plugins/modules/openssl_csr.py

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -165,66 +165,14 @@
165165
"""
166166

167167
RETURN = r"""
168-
privatekey:
169-
description:
170-
- Path to the TLS/SSL private key the CSR was generated for.
171-
- Will be V(none) if the private key has been provided in O(privatekey_content).
172-
returned: changed or success
173-
type: str
174-
sample: /etc/ssl/private/ansible.com.pem
175168
filename:
176169
description: Path to the generated Certificate Signing Request.
177170
returned: changed or success
178171
type: str
179172
sample: /etc/ssl/csr/www.ansible.com.csr
180-
subject:
181-
description: A list of the subject tuples attached to the CSR.
182-
returned: changed or success
183-
type: list
184-
elements: list
185-
sample: [['CN', 'www.ansible.com'], ['O', 'Ansible']]
186-
subjectAltName:
187-
description: The alternative names this CSR is valid for.
188-
returned: changed or success
189-
type: list
190-
elements: str
191-
sample: ['DNS:www.ansible.com', 'DNS:m.ansible.com']
192-
keyUsage:
193-
description: Purpose for which the public key may be used.
194-
returned: changed or success
195-
type: list
196-
elements: str
197-
sample: ['digitalSignature', 'keyAgreement']
198-
extendedKeyUsage:
199-
description: Additional restriction on the public key purposes.
200-
returned: changed or success
201-
type: list
202-
elements: str
203-
sample: ['clientAuth']
204-
basicConstraints:
205-
description: Indicates if the certificate belongs to a CA.
206-
returned: changed or success
207-
type: list
208-
elements: str
209-
sample: ['CA:TRUE', 'pathLenConstraint:0']
210-
ocsp_must_staple:
211-
description: Indicates whether the certificate has the OCSP Must Staple feature enabled.
212-
returned: changed or success
213-
type: bool
214-
sample: false
215173
name_constraints_permitted:
216-
description: List of permitted subtrees to sign certificates for.
217-
returned: changed or success
218-
type: list
219-
elements: str
220-
sample: ['email:.somedomain.com']
221174
version_added: 1.1.0
222175
name_constraints_excluded:
223-
description: List of excluded subtrees the CA cannot sign certificates for.
224-
returned: changed or success
225-
type: list
226-
elements: str
227-
sample: ['email:.com']
228176
version_added: 1.1.0
229177
backup_file:
230178
description: Name of backup file created.
@@ -236,6 +184,9 @@
236184
returned: if O(state) is V(present) and O(return_content) is V(true)
237185
type: str
238186
version_added: "1.0.0"
187+
188+
extends_documentation_fragment:
189+
- community.crypto._module_csr
239190
"""
240191

241192
import os

plugins/modules/openssl_csr_pipe.py

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -74,57 +74,13 @@
7474
returned: changed or success
7575
type: str
7676
sample: /etc/ssl/private/ansible.com.pem
77-
subject:
78-
description: A list of the subject tuples attached to the CSR.
79-
returned: changed or success
80-
type: list
81-
elements: list
82-
sample: [['CN', 'www.ansible.com'], ['O', 'Ansible']]
83-
subjectAltName:
84-
description: The alternative names this CSR is valid for.
85-
returned: changed or success
86-
type: list
87-
elements: str
88-
sample: ['DNS:www.ansible.com', 'DNS:m.ansible.com']
89-
keyUsage:
90-
description: Purpose for which the public key may be used.
91-
returned: changed or success
92-
type: list
93-
elements: str
94-
sample: ['digitalSignature', 'keyAgreement']
95-
extendedKeyUsage:
96-
description: Additional restriction on the public key purposes.
97-
returned: changed or success
98-
type: list
99-
elements: str
100-
sample: ['clientAuth']
101-
basicConstraints:
102-
description: Indicates if the certificate belongs to a CA.
103-
returned: changed or success
104-
type: list
105-
elements: str
106-
sample: ['CA:TRUE', 'pathLenConstraint:0']
107-
ocsp_must_staple:
108-
description: Indicates whether the certificate has the OCSP Must Staple feature enabled.
109-
returned: changed or success
110-
type: bool
111-
sample: false
112-
name_constraints_permitted:
113-
description: List of permitted subtrees to sign certificates for.
114-
returned: changed or success
115-
type: list
116-
elements: str
117-
sample: ['email:.somedomain.com']
118-
name_constraints_excluded:
119-
description: List of excluded subtrees the CA cannot sign certificates for.
120-
returned: changed or success
121-
type: list
122-
elements: str
123-
sample: ['email:.com']
12477
csr:
12578
description: The (current or generated) CSR's content.
12679
returned: changed or success
12780
type: str
81+
82+
extends_documentation_fragment:
83+
- community.crypto._module_csr
12884
"""
12985

13086
import typing as t

plugins/modules/openssl_privatekey.py

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -108,38 +108,11 @@
108108
"""
109109

110110
RETURN = r"""
111-
size:
112-
description: Size (in bits) of the TLS/SSL private key.
113-
returned: changed or success
114-
type: int
115-
sample: 4096
116-
type:
117-
description: Algorithm used to generate the TLS/SSL private key.
118-
returned: changed or success
119-
type: str
120-
sample: RSA
121-
curve:
122-
description: Elliptic curve used to generate the TLS/SSL private key.
123-
returned: changed or success, and O(type) is V(ECC)
124-
type: str
125-
sample: secp256r1
126111
filename:
127112
description: Path to the generated TLS/SSL private key file.
128113
returned: changed or success
129114
type: str
130115
sample: /etc/ssl/private/ansible.com.pem
131-
fingerprint:
132-
description:
133-
- The fingerprint of the public key. Fingerprint will be generated for each C(hashlib.algorithms) available.
134-
returned: changed or success
135-
type: dict
136-
sample:
137-
md5: "84:75:71:72:8d:04:b5:6c:4d:37:6d:66:83:f5:4c:29"
138-
sha1: "51:cc:7c:68:5d:eb:41:43:88:7e:1a:ae:c7:f8:24:72:ee:71:f6:10"
139-
sha224: "b1:19:a6:6c:14:ac:33:1d:ed:18:50:d3:06:5c:b2:32:91:f1:f1:52:8c:cb:d5:75:e9:f5:9b:46"
140-
sha256: "41:ab:c7:cb:d5:5f:30:60:46:99:ac:d4:00:70:cf:a1:76:4f:24:5d:10:24:57:5d:51:6e:09:97:df:2f:de:c7"
141-
sha384: "85:39:50:4e:de:d9:19:33:40:70:ae:10:ab:59:24:19:51:c3:a2:e4:0b:1c:b1:6e:dd:b3:0c:d9:9e:6a:46:af:da:18:f8:ef:ae:2e:c0:9a:75:2c:9b:b3:0f:3a:5f:3d"
142-
sha512: "fd:ed:5e:39:48:5f:9f:fe:7f:25:06:3f:79:08:cd:ee:a5:e7:b3:3d:13:82:87:1f:84:e1:f5:c7:28:77:53:94:86:56:38:69:f0:d9:35:22:01:1e:a6:60:...:0f:9b"
143116
backup_file:
144117
description: Name of backup file created.
145118
returned: changed and if O(backup) is V(true)
@@ -152,6 +125,9 @@
152125
returned: if O(state) is V(present) and O(return_content) is V(true)
153126
type: str
154127
version_added: '1.0.0'
128+
129+
extends_documentation_fragment:
130+
- community.crypto._module_privatekey
155131
"""
156132

157133
import os

plugins/modules/openssl_privatekey_pipe.py

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -116,33 +116,6 @@
116116
"""
117117

118118
RETURN = r"""
119-
size:
120-
description: Size (in bits) of the TLS/SSL private key.
121-
returned: changed or success
122-
type: int
123-
sample: 4096
124-
type:
125-
description: Algorithm used to generate the TLS/SSL private key.
126-
returned: changed or success
127-
type: str
128-
sample: RSA
129-
curve:
130-
description: Elliptic curve used to generate the TLS/SSL private key.
131-
returned: changed or success, and O(type) is V(ECC)
132-
type: str
133-
sample: secp256r1
134-
fingerprint:
135-
description:
136-
- The fingerprint of the public key. Fingerprint will be generated for each C(hashlib.algorithms) available.
137-
returned: changed or success
138-
type: dict
139-
sample:
140-
md5: "84:75:71:72:8d:04:b5:6c:4d:37:6d:66:83:f5:4c:29"
141-
sha1: "51:cc:7c:68:5d:eb:41:43:88:7e:1a:ae:c7:f8:24:72:ee:71:f6:10"
142-
sha224: "b1:19:a6:6c:14:ac:33:1d:ed:18:50:d3:06:5c:b2:32:91:f1:f1:52:8c:cb:d5:75:e9:f5:9b:46"
143-
sha256: "41:ab:c7:cb:d5:5f:30:60:46:99:ac:d4:00:70:cf:a1:76:4f:24:5d:10:24:57:5d:51:6e:09:97:df:2f:de:c7"
144-
sha384: "85:39:50:4e:de:d9:19:33:40:70:ae:10:ab:59:24:19:51:c3:a2:e4:0b:1c:b1:6e:dd:b3:0c:d9:9e:6a:46:af:da:18:f8:ef:ae:2e:c0:9a:75:2c:9b:b3:0f:3a:5f:3d"
145-
sha512: "fd:ed:5e:39:48:5f:9f:fe:7f:25:06:3f:79:08:cd:ee:a5:e7:b3:3d:13:82:87:1f:84:e1:f5:c7:28:77:53:94:86:56:38:69:f0:d9:35:22:01:1e:a6:60:...:0f:9b"
146119
privatekey:
147120
description:
148121
- The generated private key's content.
@@ -151,4 +124,7 @@
151124
- Will be Base64-encoded if the key is in raw format.
152125
returned: changed, or O(return_current_key) is V(true)
153126
type: str
127+
128+
extends_documentation_fragment:
129+
- community.crypto._module_privatekey
154130
"""

0 commit comments

Comments
 (0)