Documentation

    PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.19

    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
    force   boolean   Force regeneration even if key exists. **[default: false]
    group   string   Group of the private key file (numeric gid or group name).
    mode   string   Permissions of the private key file.
    owner   string   Owner of the private key file (numeric uid or username).
    path true string   Path to write the private key file.
    size   integer   Key size in bits. **[default: 4096]
    state   string present
    absent
    State of the private key. If absent, removes the key file. **[default: "present"]
    type   string RSA
    ECC
    Key type: RSA or ECC. **[default: "RSA"]

    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"