community / community.crypto / 2.18.0 / module / openssl_signature Sign data with openssl | "added in version" 1.1.0 of community.crypto" Authors: Patrick Pichler (@aveexy), Markus Teufelberger (@MarkusTeufelberger)community.crypto.openssl_signature (2.18.0) — module
Install with ansible-galaxy collection install community.crypto:==2.18.0
collections: - name: community.crypto version: 2.18.0
This module allows one to sign data using a private key.
The module uses the cryptography Python library.
- name: Sign example file community.crypto.openssl_signature: privatekey_path: private.key path: /tmp/example_file register: sig
- name: Verify signature of example file community.crypto.openssl_signature_info: certificate_path: cert.pem path: /tmp/example_file signature: "{{ sig.signature }}" register: verify
- name: Make sure the signature is valid ansible.builtin.assert: that: - verify.valid
path: description: - The file to sign. - This file will only be read and not modified. required: true type: path privatekey_path: description: - The path to the private key to use when signing. - Either O(privatekey_path) or O(privatekey_content) must be specified, but not both. type: path privatekey_content: description: - The content of the private key to use when signing the certificate signing request. - Either O(privatekey_path) or O(privatekey_content) must be specified, but not both. type: str privatekey_passphrase: description: - The passphrase for the private key. - This is required if the private key is password protected. type: str select_crypto_backend: choices: - auto - cryptography default: auto description: - Determines which crypto backend to use. - The default choice is V(auto), which tries to use C(cryptography) if available. - If set to V(cryptography), will try to use the L(cryptography,https://cryptography.io/) library. type: str
signature: description: Base64 encoded signature. returned: success type: str