Horizon inventory plugin

Note

This inventory plugin is part of the evertrust.horizon collection (version 1.5.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.

To use it in a playbook, specify: evertrust.horizon.horizon_inventory.

Synopsis

  • Generate hosts inventory from Horizon using an HCQL query.

  • Use a YAML configuration file that ends with horizon_inventory.(yml|yaml).

Parameters

Parameter

Comments

ca_bundle

path

Path of a CA bundle used to validate the Horizon instance SSL certificate.

client_cert

path

Path of a client certificate.

Required if you use certificate based authentication

client_key

path

Path of a client certificate’s key.

Required if you use certificate based authentication

endpoint

string / required

Your Horizon instance base endpoint.

It must include the protocol (https://) and no trailing slash nor path.

fields

list / elements=string

Fields to be retrieved from Horizon.

If omitted, all fields will be returned.

Choices:

  • "_id"

  • "certificate"

  • "discoveredTrusted"

  • "dn"

  • "holderId"

  • "issuer"

  • "keyType"

  • "labels"

  • "metadata"

  • "module"

  • "notAfter"

  • "notBefore"

  • "owner"

  • "profile"

  • "revocationDate"

  • "revocationReason"

  • "serial"

  • "signingAlgorithm"

  • "subjectAlternateNames"

  • "thirdPartyData"

hostnames

list / elements=string

A list in order of precedence for hostname variables.

To use labels as hostnames use the syntax label.<key>.

Default: []

query

string

HCQL query to filter the results.

x_api_id

string

Horizon identifier

Required if you use credentials authentication

x_api_key

string

Horizon password

Required if you use credentials authentication

Examples

plugin: evertrust.horizon.horizon_inventory

endpoint: "https://<horizon-endpoint>"
x_api_id: "<horizon-id>"
x_api_key: "<horizon-password>"

query: "status is valid"
fields:
  - labels
  - module
  - subjectAlternateNames

# Possible values: san.ip, san.dns, discoveryData.ip, discoveryData.Hostname, label.<key>
# To use your host IPs as inventory hostnames, the correct syntax would be label.ansible_host
hostnames:
  - label.ansible_host
  - san.dns

Authors

  • Evertrust R&D (@EverTrust)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.