ansible.windows.win_certificate_info module – Get information on certificates from a Windows Certificate Store
Note
This module is part of the ansible.windows collection (version 2.5.0).
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 ansible.windows
.
To use it in a playbook, specify: ansible.windows.win_certificate_info
.
New in ansible.windows 2.6.0
Synopsis
Returns information about certificates in a Windows Certificate Store.
Parameters
Parameter |
Comments |
---|---|
The location of the store to search. Choices:
|
|
The name of the store to search. See https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.x509certificates.storename for a list of built-in store names. Default: |
|
The thumbprint as a hex string of a certificate to find. When specified, filters the certificates return value to a single certificate See the examples for how to format the thumbprint. |
See Also
See also
- ansible.windows.win_certificate_store
Manages the certificate store.
Examples
- name: Obtain information about a particular certificate in the computer's personal store
ansible.windows.win_certificate_info:
thumbprint: BD7AF104CF1872BDB518D95C9534EA941665FD27
register: mycert
# thumbprint can also be lower case
- name: Obtain information about a particular certificate in the computer's personal store
ansible.windows.win_certificate_info:
thumbprint: bd7af104cf1872bdb518d95c9534ea941665fd27
register: mycert
- name: Obtain information about all certificates in the root store
ansible.windows.win_certificate_info:
store_name: Root
register: ca
# Import a pfx and then get information on the certificates
- name: Import pfx certificate that is password protected
ansible.windows.win_certificate_store:
path: C:\Temp\cert.pfx
state: present
password: VeryStrongPasswordHere!
become: true
become_method: runas
register: mycert
- name: Obtain information on each certificate that was touched
ansible.windows.win_certificate_info:
thumbprint: "{{ item }}"
register: mycert_stats
loop: "{{ mycert.thumbprints }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A list of information about certificates found in the store, sorted by thumbprint. Returned: success |
|
Indicates that the certificate is archived. Returned: success Sample: |
|
The base64 encoded data of the entire certificate. Returned: success |
|
Lists the registered dns names for the certificate. Returned: success Sample: |
|
The collection of the certificates extensions. Returned: success Sample: |
|
The associated alias for the certificate. Returned: success Sample: |
|
Indicates that the certificate contains a private key. Returned: success Sample: |
|
lists the intended applications for the certificate. Returned: enhanced key usages extension exists. Sample: |
|
Indicates that the certificate is a certificate authority (CA) certificate. Returned: basic constraints extension exists. Sample: |
|
The certificate issuer’s common name. Returned: success Sample: |
|
The certificate’s common name. Returned: success Sample: |
|
The certificate issuer’s distinguished name. Returned: success Sample: |
|
Defines how the certificate key can be used. If this value is not defined, the key can be used for any purpose. Returned: key usages extension exists. Sample: |
|
The number of levels allowed in a certificates path. If this value is 0, the certificate does not have a restriction. Returned: basic constraints extension exists Sample: |
|
The base64 encoded public key of the certificate. Returned: success |
|
The serial number of the certificate represented as a hexadecimal string Returned: success Sample: |
|
The algorithm used to create the certificate’s signature Returned: success Sample: |
|
The certificate’s subject key identifier Returned: subject key identifier extension exists. Sample: |
|
The certificate’s distinguished name. Returned: success Sample: |
|
The thumbprint as a hex string of the certificate. The return format will always be upper case. Returned: success Sample: |
|
The start date of the certificate represented in seconds since epoch. Returned: success Sample: |
|
The start date of the certificate represented as an iso8601 formatted date. Returned: success Sample: |
|
The expiry date of the certificate represented in seconds since epoch. Returned: success Sample: |
|
The expiry date of the certificate represented as an iso8601 formatted date. Returned: success Sample: |
|
The x509 format version of the certificate Returned: success Sample: |
|
Whether any certificates were found in the store. When thumbprint is specified, returns true only if the certificate mathing the thumbprint exists. Returned: success Sample: |