Documentation
PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.21
Documentation for other releases can be found by using the version selector in the top right of any doc page.openssl_privatekey
Generate SSL/TLS private keys.
Attributes
check_mode:
support: full
Parameters
| Parameter | Required | Type | Values | Description |
|---|---|---|---|---|
| path | true | string | Path to write the private key file. | |
| size | integer | Key size in bits. **[default: 4096] |
||
| type | string | RSA ECC |
Key type: RSA or ECC. **[default: "RSA"] |
|
| mode | string | Permissions of the private key file. | ||
| owner | string | Owner of the private key file (numeric uid or username). | ||
| group | string | Group of the private key file (numeric gid or group name). | ||
| force | boolean | Force regeneration even if key exists. **[default: false] |
||
| state | string | present absent |
State of the private key. If absent, removes the key file. **[default: "present"] |
Examples
- name: Generate RSA private key
openssl_privatekey:
path: /etc/ssl/private/server.key
size: 4096
- name: Generate ECC private key
openssl_privatekey:
path: /etc/ssl/private/server.key
type: ECC
- name: Generate key with custom permissions
openssl_privatekey:
path: /etc/ssl/private/server.key
size: 2048
mode: "0600"