{"id":15022772,"url":"https://github.com/voxpupuli/puppet-hiera","last_synced_at":"2025-04-07T09:15:23.481Z","repository":{"id":45050036,"uuid":"5417020","full_name":"voxpupuli/puppet-hiera","owner":"voxpupuli","description":"Hiera hierarchy module for templating `hiera.yaml`","archived":false,"fork":false,"pushed_at":"2024-09-17T07:36:09.000Z","size":582,"stargazers_count":33,"open_issues_count":21,"forks_count":105,"subscribers_count":45,"default_branch":"master","last_synced_at":"2024-10-29T14:22:36.285Z","etag":null,"topics":["centos-puppet-module","debian-puppet-module","hacktoberfest","linux-puppet-module","puppet","redhat-puppet-module","ubuntu-puppet-module"],"latest_commit_sha":null,"homepage":"https://forge.puppet.com/puppet/hiera","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voxpupuli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"vox-pupuli","github":"voxpupuli"}},"created_at":"2012-08-14T18:47:18.000Z","updated_at":"2024-10-18T15:44:45.000Z","dependencies_parsed_at":"2024-01-13T17:13:12.037Z","dependency_job_id":"bc2aed7d-b8ac-4903-8c27-1216e90d391e","html_url":"https://github.com/voxpupuli/puppet-hiera","commit_stats":{"total_commits":351,"total_committers":73,"mean_commits":4.808219178082192,"dds":0.6923076923076923,"last_synced_commit":"06c5483bd0af6cbb0adf8d3ae1d789ce856fe2a4"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-hiera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-hiera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-hiera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-hiera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpupuli","download_url":"https://codeload.github.com/voxpupuli/puppet-hiera/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419856,"owners_count":20936012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["centos-puppet-module","debian-puppet-module","hacktoberfest","linux-puppet-module","puppet","redhat-puppet-module","ubuntu-puppet-module"],"created_at":"2024-09-24T19:58:22.068Z","updated_at":"2025-04-07T09:15:23.456Z","avatar_url":"https://github.com/voxpupuli.png","language":"Ruby","funding_links":["https://opencollective.com/vox-pupuli","https://github.com/sponsors/voxpupuli"],"categories":[],"sub_categories":[],"readme":"# Hiera module for Puppet\n\n[![Build Status](https://travis-ci.org/voxpupuli/puppet-hiera.png?branch=master)](https://travis-ci.org/voxpupuli/puppet-hiera)\n[![Code Coverage](https://coveralls.io/repos/github/voxpupuli/puppet-hiera/badge.svg?branch=master)](https://coveralls.io/github/voxpupuli/puppet-hiera)\n[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/hiera.svg)](https://forge.puppetlabs.com/puppet/hiera)\n[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/hiera.svg)](https://forge.puppetlabs.com/puppet/hiera)\n[![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/hiera.svg)](https://forge.puppetlabs.com/puppet/hiera)\n[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/hiera.svg)](https://forge.puppetlabs.com/puppet/hiera)\n\n#### Table of Contents\n\n1. [Overview](#overview)\n2. [Module Description - What the module does and why it is useful](#module-description)\n3. [Setup - The basics of getting started with hiera](#setup)\n    * [What hiera affects](#what-hiera-affects)\n    * [Setup requirements](#setup-requirements)\n    * [Beginning with hiera](#beginning-with-hiera)\n4. [Usage - Configuration options and additional functionality](#usage)\n5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)\n5. [Limitations - OS compatibility, etc.](#limitations)\n6. [Development - Guide for contributing to the module](#development)\n\n## Module Description\n\nThis module configures [Hiera](https://github.com/puppetlabs/hiera) for Puppet.\n\n## Setup\n\n### What hiera affects\n\n- Hiera yaml file\n- Hiera datadir\n- hiera-eyaml package\n- keys/ directory for eyaml\n- /etc/hiera.yaml for symlink\n\n### Setup requirements\n\nTo use the eyaml backend with the modern puppetserver, you will need the [puppetlabs-puppetserver_gem](https://forge.puppetlabs.com/puppetlabs/puppetserver_gem) module.\n\n### Beginning with hiera\n\nDeclaring the class with a given hierarchy is a pretty good starting point:\n\nThis class will write out a hiera.yaml file in either\n/etc/puppetlabs/puppet/hiera.yaml or /etc/puppet/hiera.yaml (depending on if the\nnode is running Puppet Enterprise or not).\n\n```puppet\nclass { 'hiera':\n  hierarchy =\u003e [\n    '%{environment}/%{calling_class}',\n    '%{environment}',\n    'common',\n  ],\n}\n```\n### For Hiera version 5\n```puppet\nclass { 'hiera':\n          hiera_version   =\u003e  '5',\n          hiera5_defaults =\u003e  {\"datadir\" =\u003e \"data\", \"data_hash\" =\u003e \"yaml_data\"},\n          hierarchy       =\u003e  [\n                                {\"name\" =\u003e  \"Virtual yaml\", \"path\"  =\u003e  \"virtual/%{virtual}.yaml\"},\n                                {\"name\" =\u003e  \"Nodes yaml\", \"paths\" =\u003e  ['nodes/%{trusted.certname}.yaml', 'nodes/%{osfamily}.yaml']},\n                                {\"name\" =\u003e  \"Default yaml file\", \"path\" =\u003e  \"common.yaml\"},\n                              ],\n}\n```\n** Note: For Hiera version 5 when calling the class, please remember to pass '5' to 'hiera_version' as in the example above. **\n** Also please note that 'hierarchy' is an array of hash in version 5. **\n\nThe resulting output in /etc/puppet/hiera.yaml:\n\n```yaml\n---\n:backends:\n  - yaml\n:logger: console\n:hierarchy:\n  - \"%{environment}/%{calling_class}\"\n  - \"%{environment}\"\n  - common\n\n:yaml:\n   :datadir: /etc/puppet/hieradata\n```\n### Resulting output for Hiera 5\n\n```yaml\n# hiera.yaml Managed by Puppet\nversion: 5\ndefaults:\n  datadir: data\n  data_hash: yaml_data\nhierarchy:\n\n  - name: \"Virtual yaml\"\n    path: \"virtual/%{virtual}.yaml\"\n\n  - name: \"Nodes yaml\"\n    paths:\n      - \"nodes/%{trusted.certname}.yaml\"\n      - \"nodes/%{osfamily}.yaml\"\n\n  - name: \"Default yaml file\"\n    path: \"common.yaml\"\n```\n\n## Usage\n\n## Reference\n\nThis module will also allow you to configure different options for logger and\nmerge_behavior.  The default behavior is to set logger to console and merge\nbehavior to native.\n\nFor details and valid options see [Configuring Hiera](https://docs.puppetlabs.com/hiera/1/configuring.html#global-settings).\n\n```puppet\nclass { 'hiera':\n  hierarchy      =\u003e [\n    '%{environment}/%{calling_class}',\n    '%{environment}',\n    'common',\n  ],\n  logger         =\u003e 'console',\n  merge_behavior =\u003e 'deeper'\n}\n```\n## For Hiera version 5 please see the example above in beginning with Hiera.\n\nThe resulting output in /etc/puppet/hiera.yaml:\n\n```yaml\n---\n:backends:\n  - yaml\n:logger: console\n:hierarchy:\n  - \"%{environment}/%{calling_class}\"\n  - \"%{environment}\"\n  - common\n\n:yaml:\n   :datadir: /etc/puppet/hieradata\n\n:merge_behavior: deeper\n```\n\n### Hiera-Eyaml-GPG\n\nThe default PKCS#7 encryption scheme used by hiera-eyaml is perfect if only\nsimple encryption and decryption is needed.\n\nHowever, if you are in a sizable team it helps to encrypt and decrypt data with\nmultiple keys. This means that each team member can hold their own private key\nand so can the puppetmaster. Equally, each puppet master can have their own key\nif desired and when you need to rotate keys for either users or puppet masters,\nre-encrypting your files and changing the key everywhere does not need to be\ndone in lockstep.\n\n#### Requirements\n\n**Note:** This module will create a /gpg sub-directory in the ```$keysdir```.\n\n1. The GPG keyring must be passphraseless on the on the PuppetServer(Master).\n1. The GPG keyring must live in the /gpg sub-directory in the ```$keysdir```.\n1. The GPG keyring must be owned by the Puppet user. ex: pe-puppet\n\n#### GPG Keyring Creation Tips\n\n##### RNG-TOOLS\n\nWhen generating a GPG keyring the system requires a good amount of entropy.\nTo help generate entropy to speed up the process then rng-tools package on RHEL\nbased systems or equivilent can be used.  Note: Update the ```/etc/sysconfig/rngd```\nor equivilent file to set the EXTRAOPTIONS to\n```EXTRAOPTIONS=\"-r /dev/urandom -o /dev/random -t 5\"```\n\n##### Keyring Generation\n\nBelow is a sample GPG answers file that will assist in generating a\npassphraseless key\n\n```bash\ncat \u003c\u003c EOF \u003e\u003e /tmp/gpg_answers\n%echo Generating a Puppet Hiera GPG Key\nKey-Type: RSA\nKey-Length: 4096\nSubkey-Type: ELG-E\nSubkey-Length: 4096\nName-Real: Hiera Data\nName-Comment: Hiera Data Encryption\nName-Email: puppet@$(hostname -d)\nExpire-Date: 0\n%no-ask-passphrase\n# Do a commit here, so that we can later print \"done\" :-)\n# %commit\n# %echo done\nEOF\n```\n\nYou can then use the GPG answer file to generate your keyring within the\n/gpg sub-directory in the ```$keysdir```\n\n```bash\ngpg --batch --homedir /etc/puppetlabs/puppet/keys/gpg --gen-key /tmp/gpg_answers\n```\n\n#### Usage\n\n```puppet\nclass { 'hiera':\n  hierarchy            =\u003e [\n    'nodes/%{clientcert}',\n    'locations/%{location}',\n    'environments/%{applicationtier}',\n    'common',\n  ],\n  eyaml                =\u003e true,\n  eyaml_gpg            =\u003e true,\n  eyaml_gpg_recipients =\u003e 'sihil@example.com,gtmtech@example.com,tpoulton@example.com',\n}\n```\n\nThe resulting output in /etc/puppet/hiera.yaml:\n\n```yaml\n---\n:backends:\n  - eyaml\n  - yaml\n:logger: console\n:hierarchy:\n  - \"nodes/%{clientcert}\"\n  - \"locations/%{location}\"\n  - \"environments/%{applicationtier}\"\n  - common\n\n:yaml:\n   :datadir: /etc/puppet/hieradata\n\n\n:eyaml:\n   :datadir: /etc/puppet/hieradata\n   :pkcs7_private_key: /etc/puppet/keys/private_key.pkcs7.pem\n   :pkcs7_public_key:  /etc/puppet/keys/public_key.pkcs7.pem\n   :encrypt_method: \"gpg\"\n   :gpg_gnupghome: \"/etc/puppet/keys/gpg\"\n   :gpg_recipients: \"sihil@example.com,gtmtech@example.com,tpoulton@example.com\"\n```\n\n### Classes\n\n#### Public Classes\n\n- hiera: Main class to configure hiera\n\n#### Private Classes\n\n- hiera::params: Handles variable conditionals\n- hiera::eyaml: Handles eyaml configuration\n\n## Limitations\n\nThe `eyaml_version` parameter does not currently modify the eyaml version of the\ncommand-line gem on pe-puppetserver.\n\n## Development\n\nPull requests on github! If someone wrote spec tests, that would be awesome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-hiera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpupuli%2Fpuppet-hiera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-hiera/lists"}