Ask Your Question

Create a JSON config file from Hiera data

asked 2018-07-12 10:41:50 -0600

chroche gravatar image

Hi guys,

I'm fairly new to Puppet, using Puppet v4.10 with Hiera v3.3. I would like to create a config file in JSON format directly from its HIera definition, i.e., something like:

  name: /etc/docker/daemon.json
    log-driver: 'fluentd'
        fluentd-address: 'localhost:5400'

which would translate automatically to /etc/docker/daemon.json with content

   "log-driver": "fluentd",
   "log-opts": {
     "fluentd-address": "fluentdhost:24224"

I'm pretty sure there must be a way to do that using Hiera automatic parameter lookup, but I haven't a single clue on how to write that properly. Any idea?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-16 05:50:03 -0600

fvoges gravatar image

Check fiddyspence/hash_file module from the forge. It does exactly what you need

edit flag offensive delete link more


Hi, that's perfect, thank you!

chroche gravatar imagechroche ( 2018-07-16 08:14:25 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-07-12 10:41:50 -0600

Seen: 99 times

Last updated: Jul 16