community.general.hiera (8.5.0) — lookup

get info from hiera data

Authors: Juan Manuel Parrilla (@jparrill)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Retrieves data from an Puppetmaster node using Hiera as ENC.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# All this examples depends on hiera.yml that describes the hierarchy

- name: "a value from Hiera 'DB'"
  ansible.builtin.debug:
    msg: "{{ lookup('community.general.hiera', 'foo') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "a value from a Hiera 'DB' on other environment"
  ansible.builtin.debug:
    msg: "{{ lookup('community.general.hiera', 'foo environment=production') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "a value from a Hiera 'DB' for a concrete node"
  ansible.builtin.debug:
    msg: "{{ lookup('community.general.hiera', 'foo fqdn=puppet01.localdomain') }}"

Inputs

    
_terms:
    description:
    - The list of keys to lookup on the Puppetmaster.
    elements: string
    required: true
    type: list

executable:
    default: /usr/bin/hiera
    description:
    - Binary file to execute Hiera.
    env:
    - name: ANSIBLE_HIERA_BIN

config_file:
    default: /etc/hiera.yaml
    description:
    - File that describes the hierarchy of Hiera.
    env:
    - name: ANSIBLE_HIERA_CFG

Outputs

_raw:
  description:
  - a value associated with input key
  elements: str
  type: list