ansible / ansible.builtin / v2.3.2.0-1 / module / openssl_privatekey Generate OpenSSL private keys. | "added in version" 2.3 of ansible.builtin" Authors: Yanis Guenane (@Spredzy) preview | supported by communityansible.builtin.openssl_privatekey (v2.3.2.0-1) — module
pip
Install with pip install ansible==2.3.2.0.post1
This module allows one to (re)generate OpenSSL private keys. It uses the pyOpenSSL python library to interact with openssl. One can generate either RSA or DSA private keys. Keys are generated in PEM format.
# Generate an OpenSSL private key with the default values (4096 bits, RSA) # and no public key - openssl_privatekey: path: /etc/ssl/private/ansible.com.pem
# Generate an OpenSSL private key with a different size (2048 bits) - openssl_privatekey: path: /etc/ssl/private/ansible.com.pem size: 2048
# Force regenerate an OpenSSL private key if it already exists - openssl_privatekey: path: /etc/ssl/private/ansible.com.pem force: True
# Generate an OpenSSL private key with a different algorithm (DSA) - openssl_privatekey: path: /etc/ssl/private/ansible.com.pem type: DSA
path: description: - Name of the file in which the generated TLS/SSL private key will be written. It will have 0600 mode. required: true size: default: 4096 description: - Size (in bits) of the TLS/SSL key to generate required: false type: choices: - RSA - DSA default: RSA description: - The algorithm used to generate the TLS/SSL private key required: false force: choices: - true - false default: false description: - Should the key be regenerated even it it already exists required: false state: choices: - present - absent default: present description: - Whether the private key should exist or not, taking action if the state is different from what is stated. required: false
filename: description: Path to the generated TLS/SSL private key file returned: - changed - success sample: /etc/ssl/private/ansible.com.pem type: string size: description: Size (in bits) of the TLS/SSL private key returned: - changed - success sample: 4096 type: integer type: description: Algorithm used to generate the TLS/SSL private key returned: - changed - success sample: RSA type: string