Documentation

hiera - get info from hiera data

New in version 2.4.

Synopsis

  • Retrieves data from an Puppetmaster node using Hiera as ENC

Requirements

The below requirements are needed on the local master node that executes this lookup.

  • hiera (command line utility)

Parameters

Parameter Choices/Defaults Configuration Comments
_bin_file Default:
/usr/bin/hiera
env:ANSIBLE_HIERA_BIN
Binary file to execute Hiera
_hiera_key
list

required
The list of keys to lookup on the Puppetmaster
_hierarchy_file Default:
/etc/hiera.yaml
env:ANSIBLE_HIERA_CFG
File that describes the hierarchy of Hiera

Examples

# All this examples depends on hiera.yml that describes the hierarchy

- name: "a value from Hiera 'DB'"
  debug: msg={{ lookup('hiera', 'foo') }}

- name: "a value from a Hiera 'DB' on other environment"
  debug: msg={{ lookup('hiera', 'foo environment=production') }}

- name: "a value from a Hiera 'DB' for a concrete node"
  debug: msg={{ lookup('hiera', 'foo fqdn=puppet01.localdomain') }}

Return Values

Common return values are documented here, the following are the fields unique to this lookup:

Key Returned Description
_raw
strings
a value associated with input key



Status

This lookup is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This lookup is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Juan Manuel Parrilla (@jparrill)

Hint

If you notice any issues in this documentation you can edit this document to improve it.