Note
This plugin is part of the community.crypto collection (version 1.9.6).
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
.
To use it in a playbook, specify: community.crypto.certificate_complete_chain
.
openssl verify ...
.The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
input_chain string / required | A concatenated set of certificates in PEM format forming a chain. The module will try to complete this chain. | |
intermediate_certificates list / elements=path | Default: [] | A list of filenames or directories. A filename is assumed to point to a file containing one or more certificates in PEM format. All certificates in this file will be added to the set of root certificates. If a directory name is given, all files in the directory and its subdirectories will be scanned and tried to be parsed as concatenated certificates in PEM format. Symbolic links will be followed. |
root_certificates list / elements=path / required | A list of filenames or directories. A filename is assumed to point to a file containing one or more certificates in PEM format. All certificates in this file will be added to the set of root certificates. If a directory name is given, all files in the directory and its subdirectories will be scanned and tried to be parsed as concatenated certificates in PEM format. Symbolic links will be followed. |
# Given a leaf certificate for www.ansible.com and one or more intermediate # certificates, finds the associated root certificate. - name: Find root certificate community.crypto.certificate_complete_chain: input_chain: "{{ lookup('file', '/etc/ssl/csr/www.ansible.com-fullchain.pem') }}" root_certificates: - /etc/ca-certificates/ register: www_ansible_com - name: Write root certificate to disk copy: dest: /etc/ssl/csr/www.ansible.com-root.pem content: "{{ www_ansible_com.root }}" # Given a leaf certificate for www.ansible.com, and a list of intermediate # certificates, finds the associated root certificate. - name: Find root certificate community.crypto.certificate_complete_chain: input_chain: "{{ lookup('file', '/etc/ssl/csr/www.ansible.com.pem') }}" intermediate_certificates: - /etc/ssl/csr/www.ansible.com-chain.pem root_certificates: - /etc/ca-certificates/ register: www_ansible_com - name: Write complete chain to disk copy: dest: /etc/ssl/csr/www.ansible.com-completechain.pem content: "{{ ''.join(www_ansible_com.complete_chain) }}" - name: Write root chain (intermediates and root) to disk copy: dest: /etc/ssl/csr/www.ansible.com-rootchain.pem content: "{{ ''.join(www_ansible_com.chain) }}"
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
chain list / elements=string | success | The chain added to the given input chain. Includes the root certificate. Returned as a list of PEM certificates. |
complete_chain list / elements=string | success | The completed chain, including leaf, all intermediates, and root. Returned as a list of PEM certificates. |
root string | success | The root certificate in PEM format. |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/crypto/certificate_complete_chain_module.html