Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 6104

Hiera with masterless Puppet - how to extract data from available facts?

$
0
0
I'd need to infer some information from available facts, e.g. given a hostname like `dev-london1-server0`, available as fact to hiera, I would like to extract the environment (`dev`), the datacenter (`london1`) and optionally the server name (`server0`), so that I can use them to instruct hiera how to navigate the hierarchy. For example I'd like an hierarchy like this: hieradata/dev/london1/common.yaml hieradata/dev/london1/dev-london1-server0.yaml hieradata/dev/london1/dev-london1-server1.yaml hieradata/dev/london2/common.yaml ... with a hiera.yaml like this: --- :backends: - yaml :yaml: :datadir: ./hieradata :hierarchy: - "%{env}/%{datacenter}/%{::fqdn}" - "%{env}/%{datacenter}/common" - "virtual/%{::virtual}" - "osfamily/%{osfamily}" - common My idea is to extract %{env} and %{datacenter} from the local `::hostname` provided by facter (e.g. `dev-london1-server0`). Is there a way to do this? What alternative solution could be applied? As mentioned, this is a masterless structure. Thanks.

Viewing all articles
Browse latest Browse all 6104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>