Horizon enrollment plugin
Note
This module is part of the evertrust.horizon collection (version 2.0.0).
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 evertrust.horizon.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: evertrust.horizon.horizon_enroll.
Synopsis
Performs an enrollment against the Horizon API.
Note
This module has a corresponding action plugin.
Requirements
The below requirements are needed on the host that executes this module.
cryptography>=3.4.0
Parameters
Parameter |
Comments |
|---|---|
Path of a CA bundle used to validate the Horizon instance SSL certificate. |
|
Path of a client certificate. Required if you use certificate based authentication |
|
Path to the private key used for client-certificate authentication. Required if you use certificate based authentication. Restrict access to the key and inventory configuration files. |
|
Maximum number of seconds to wait for the controller to establish a connection to Horizon. Default: |
|
Certificate’s contact email. Default value will be the requester contact email address. |
|
A certificate signing request, or the path to the CSR file. If none is provided, one will be generated on-the-fly. |
|
The path to a CSR file. |
|
Your Horizon instance base endpoint. It must include the protocol (https://) and no trailing slash nor path. |
|
Key type to use when generating a key pair. If omitted, the default key type from the certificate profile is used. Choices:
|
|
Certificate’s labels. |
|
Certificate metadata as key-value pairs. |
|
Enrollment mode. If empty, will be inferred from the Horizon certificate profile configuration. Choices:
|
|
Certificate’s owner. |
|
Security password for the certificate. Password policies will be applied to check validity. Required only if the enrollment is centralized and the password generation mode is not random. Can also be required if the profile allows both centralized and decentralized enrollment with manual password generation. In that case, a password is necessary for decentralized enrollment. |
|
Name of the profile that will be used to enroll the certificate. |
|
Maximum number of seconds to wait between response reads by the controller after connecting to Horizon. Default: |
|
Certificate’s subject alternative names (SANs) of the certificate. Authorized values are: [dnsname, rfc822name, ipaddress, othername_upn, othername_guid, uri]. |
|
Certificate’s subject. You can either give the description of the subject, or the full DN. If you give the DN, other values won’t be used. |
|
Certificate’s team. |
|
Horizon identifier Required if you use credentials authentication |
|
Secret API key used for Horizon credential authentication. Required if you use credentials authentication. Store this value with Ansible Vault. Tasks containing lookup expressions with this value should use |
Notes
Note
Enrolling a certificate requires permissions on the related profile.
Be sure to use the “Enroll API” permission instead of “Enroll”.
Examples
- name: Enrolling a certificate in a centralized way
evertrust.horizon.horizon_enroll:
endpoint: "https://<horizon-endpoint>"
x_api_id: "<horizon-id>"
x_api_key: "<horizon-password>"
mode: "centralized"
password: "examplePassword"
key_type: "rsa-2048"
profile: "exampleProfile"
subject:
cn.1: "exampleCN"
sans:
dnsname: "exampleDnsname"
labels:
snow_id: "value1"
exp_tech: "value2"
- name: Enrolling a certificate in a decentralized way with a CSR
evertrust.horizon.horizon_enroll:
endpoint: "https://<horizon-endpoint>"
x_api_id: "<horizon-id>"
x_api_key: "<horizon-password>"
mode: "decentralized"
csr: |
-----BEGIN CERTIFICATE REQUEST-----
// Content
-----END CERTIFICATE REQUEST-----
password: "examplePassword"
key_type: "rsa-2048"
profile: "exampleProfile"
subject:
cn.1: "exampleCN"
ou.1: "exampleFirstOU"
ou.2: "exampleSecondOU"
sans:
dnsname:
- "exampleDnsName1"
- "exampleDnsName2"
labels:
snow_id: "value1"
exp_tech: "value2"
- name: Enrolling a certificate in a decentralized way with CSR file
evertrust.horizon.horizon_enroll:
endpoint: "https://<horizon-endpoint>"
x_api_id: "<horizon-id>"
x_api_key: "<horizon-password>"
mode: "decentralized"
csr:
src: "/the/path/to/my/CSR.csr"
password: "examplePassword"
key_type: "rsa-2048"
profile: "exampleProfile"
subject:
cn.1: "exampleCN"
ou:
- "exampleFirstOU"
- "exampleSecondOU"
sans:
dnsname: "exampleDnsName"
labels:
label1: "value1"
label2: "value2"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The certificate generated by the enrollment. Returned: On successful certificate issuance |
|
Horizon internal ID. Returned: If present |
|
The certificate’s PEM-encoded content. Returned: If present |
|
The certificate’s contact email. It will be used to send notifications about the certificate’s expiration and revocation. Returned: If present |
|
Whether the certificate’s revocation status is synchronized with a CRL. Returned: If present |
|
True if the certificate was discovered and issued by an existing trusted CA. False if the certificate was discovered but not issued by a trusted CA. Null if the certificate was not discovered. Returned: If present |
|
A list of metadata containing information on where the certificate was discovered. Returned: Only if the certificate was discovered |
|
The certificate’s hostnames (netscan only). Returned: If present |
|
The certificate’s host IP address. Returned: Always |
|
The certificate’s host operating system (localscan only). Returned: If present |
|
The path to the certificate on the host machine (localscan only). Returned: If present |
|
Information on the type of discovery that discovered this certificate. Returned: Always |
|
The ports on which the certificate is exposed for HTTPS connection. Returned: If present |
|
The number of the port. Returned: Always |
|
Protocol version used. Returned: Always |
|
The path of the configuration files that were used to find the certificates. Returned: If present |
|
A list of metadata containing information on how and when the certificate was discovered. Returned: If present |
|
The discovery campaign’s name. Returned: Always |
|
Identifier of the user that discovered this certificate. Returned: If present |
|
When this certificate was discovered for the last time. Returned: Always |
|
The certificate’s Distinguished Name. Returned: If present |
|
The certificate’s extensions. Returned: If present |
|
The extension’s type. Returned: Always |
|
The extension’s value. Returned: Always |
|
The certificate’s grades for the enabled grading policies. Returned: If present |
|
The grade awarded by the grading policy. Returned: Always |
|
The name of the grading policy. Returned: Always |
|
The certificate’s computed holder ID. It counts similar certificates used simultaneously by the same holder. Returned: If present |
|
The certificate’s issuer Distinguished Name. Returned: If present |
|
The certificate’s key type. Returned: If present |
|
The certificate’s labels. Returned: If present |
|
The label’s name. Returned: Always |
|
The label’s value. Returned: Always |
|
The certificate’s technical metadata used internally. Returned: If present |
|
The metadata name. Returned: Always |
|
The metadata value. Returned: Always |
|
The certificate’s module. Returned: If present |
|
The certificate’s expiration date in milliseconds since the epoch. Returned: If present |
|
The certificate’s start date in milliseconds since the epoch. Returned: If present |
|
The certificate’s owner. This is a reference to a local identity identifier. Returned: If present |
|
The certificate’s profile. Returned: If present |
|
The certificate’s public key thumbprint. Returned: If present |
|
The certificate’s revocation date in milliseconds since the epoch. This field is only present if the certificate is revoked. Returned: If present |
|
The certificate’s revocation reason. Returned: If present |
|
Whether the certificate is revoked. Returned: If present |
|
Whether the certificate is self-signed. Returned: If present |
|
The certificate’s serial number. Returned: If present |
|
The certificate’s signing algorithm. Returned: If present |
|
The certificate’s Subject Alternate Names. Returned: If present |
|
The type of the SAN. Returned: Always |
|
The value of the SAN. Returned: Always |
|
The certificate’s team, as a reference to a team identifier. It determines certificate permissions and notification recipients. Returned: If present |
|
The certificate’s information about synchronization with Horizon supported third parties. Returned: If present |
|
The third party connector name on which this certificate is synchronized. Returned: Always |
|
The fingerprint of this certificate on the third party. Returned: If present |
|
The ID of this certificate on the third party. Returned: Always |
|
The date when the certificate was pushed to this third party. Returned: If present |
|
The date when the certificate was removed from this third party (in case of revocation). Returned: If present |
|
The certificate’s thumbprint. Returned: If present |
|
The result of the execution of triggers on this certificate. Returned: If present |
|
Contains details on this trigger’s execution. Returned: If present |
|
The event that triggered the trigger. Returned: Always |
|
The last time this trigger was executed for this certificate and this event. Returned: Always |
|
The name of the trigger that was executed. Returned: Always |
|
Time that will be waited between the two successive executions of this trigger. Returned: If present |
|
The next scheduled execution time for this trigger. Returned: If present |
|
The number of remaining tries before the trigger is abandoned. Returned: If present |
|
Is this trigger manually retryable. Returned: Always |
|
The status of the trigger after its execution. Returned: Always |
|
The type of the trigger. Returned: Always |
|
Certificate’s trust chain. Returned: When the certificate is returned |
|
Certificate’s private key. Returned: If enrollment mode is “centralized” or if a key pair was generated on-the-fly |
|
Base64-encoded PKCS#12 Returned: If enrollment mode is “centralized” or if a key pair was generated on-the-fly |
|
PKCS#12 password. Returned: If enrollment mode is “centralized” or if a key pair was generated on-the-fly |