Note
This filter plugin is part of the community.crypto collection (version 2.26.5).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.crypto. You need further requirements to be able to use this filter plugin, see Requirements for details.
To use it in a playbook, specify: community.crypto.x509_certificate_info.
New in community.crypto 2.10.0
The below requirements are needed on the local controller node that executes this filter.
name_encoding is set to another value than ignore, the idna Python library needs to be installed.This describes the input of the filter, the value before | community.crypto.x509_certificate_info.
Parameter | Comments |
|---|---|
Input string / required | The content of the X.509 certificate in PEM format. |
This describes keyword parameters of the filter. These are the values key1=value1, key2=value2 and so on in the following example: input | community.crypto.x509_certificate_info(key1=value1, key2=value2, ...)
Parameter | Comments |
|---|---|
name_encoding string | How to encode names (DNS names, URIs, email addresses) in return values.
Note that Choices:
|
See also
Provide information of OpenSSL X.509 certificates.
Convert an integer to a colon-separated list of hex numbers.
---
- name: Show the Subject Alt Names of the certificate
ansible.builtin.debug:
msg: >-
{{
(
lookup('ansible.builtin.file', '/path/to/cert.pem')
| community.crypto.x509_certificate_info
).subject_alt_name | join(', ')
}}
Key | Description |
|---|---|
Return value dictionary | Information on the certificate. Returned: success |
|
authority_cert_issuer list / elements=string |
The certificate’s authority cert issuer as a list of general names. Is See Returned: success Sample: |
|
authority_cert_serial_number integer |
The certificate’s authority cert serial number. Is This return value is an integer. If you need the serial numbers as a colon-separated hex string, such as Returned: success Sample: |
|
authority_key_identifier string |
The certificate’s authority key identifier. The identifier is returned in hexadecimal, with Is Returned: success Sample: |
|
basic_constraints list / elements=string |
Entries in the Returned: success Sample: |
|
basic_constraints_critical boolean |
Whether the Returned: success |
|
expired boolean |
Whether the certificate is expired (in other words, Returned: success |
|
extended_key_usage list / elements=string |
Entries in the Returned: success Sample: |
|
extended_key_usage_critical boolean |
Whether the Returned: success |
|
extensions_by_oid dictionary |
Returns a dictionary for every extension OID. Returned: success Sample: |
|
critical boolean |
Whether the extension is critical. Returned: success |
|
value string |
The Base64 encoded value (in DER format) of the extension. Note that depending on the Returned: success Sample: |
|
fingerprints dictionary |
Fingerprints of the DER-encoded form of the whole certificate. For every hash algorithm available, the fingerprint is computed. Returned: success Sample: |
|
issuer dictionary |
The certificate’s issuer. Note that for repeated values, only the last one will be returned. Returned: success Sample: |
|
issuer_ordered list / elements=list |
The certificate’s issuer as an ordered list of tuples. Returned: success Sample: |
|
issuer_uri string |
The Issuer URI, if included in the certificate. Will be Returned: success |
|
key_usage string |
Entries in the Returned: success Sample: |
|
key_usage_critical boolean |
Whether the Returned: success |
|
not_after string |
Returned: success Sample: |
|
not_before string |
Returned: success Sample: |
|
ocsp_must_staple boolean |
Returned: success |
|
ocsp_must_staple_critical boolean |
Whether the Returned: success |
|
ocsp_uri string |
The OCSP responder URI, if included in the certificate. Will be Returned: success |
|
public_key string |
Certificate’s public key in PEM format. Returned: success Sample: |
|
public_key_data dictionary |
Public key data. Depends on the public key’s type. Returned: success |
|
curve string |
The curve’s name for ECC. Returned: When |
|
exponent integer |
The RSA key’s public exponent. Returned: When |
|
exponent_size integer |
The maximum number of bits of a private key. This is basically the bit size of the subgroup used. Returned: When |
|
g integer |
The This is the element spanning the subgroup of the multiplicative group of the prime field used. Returned: When |
|
modulus integer |
The RSA key’s modulus. Returned: When |
|
p integer |
The This is the prime modulus upon which arithmetic takes place. Returned: When |
|
q integer |
The This is a prime that divides Returned: When |
|
size integer |
Bit size of modulus (RSA) or prime number (DSA). Returned: When |
|
x integer |
The Returned: When |
|
y integer |
For For Returned: When |
|
public_key_fingerprints dictionary |
Fingerprints of certificate’s public key. For every hash algorithm available, the fingerprint is computed. Returned: success Sample: |
|
public_key_type string |
The certificate’s public key’s type. One of Will start with Returned: success Sample: |
|
serial_number integer |
The certificate’s serial number. This return value is an integer. If you need the serial numbers as a colon-separated hex string, such as Returned: success Sample: |
|
signature_algorithm string |
The signature algorithm used to sign the certificate. Returned: success Sample: |
|
subject dictionary |
The certificate’s subject as a dictionary. Note that for repeated values, only the last one will be returned. Returned: success Sample: |
|
subject_alt_name list / elements=string |
Entries in the See Returned: success Sample: |
|
subject_alt_name_critical boolean |
Whether the Returned: success |
|
subject_key_identifier string |
The certificate’s subject key identifier. The identifier is returned in hexadecimal, with Is Returned: success Sample: |
|
subject_ordered list / elements=list |
The certificate’s subject as an ordered list of tuples. Returned: success Sample: |
|
version integer |
The certificate version. Returned: success Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/crypto/x509_certificate_info_filter.html