Ask Your Question
5

A Heira example with complicated data?

asked 2013-01-15 15:22:10 -0500

ramindk gravatar image

Most of the examples of using Hiera are very very simple. They usually contain one element or possibly a single hash or array. Are there any examples using a hash of hashes in a real life example?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
8

answered 2013-01-15 16:00:28 -0500

ramindk gravatar image

updated 2013-01-16 10:28:07 -0500

The real example in this case is using sender dependent relays in Postfix. Our data will be the mta.yaml file below. A hash of hashes and one of our values, sender, is also an array.

mta.yaml

---
postfix_relays:
  some-relay1.somedomain.com:
    user:   'aaaaaaaaaaa'
    pass:   'ppppppppppp'
    tls:    'true'
    sender:
     - 'testing1@mydomain.com'
  some-relay2.somedomain2.com:
    user:   'ccccccccccc'
    pass:   'qqqqqqqqqqq'
    sender:
     - 'testing2@mydomain.com'
     - 'testing2@mydomain2.com'

We will consume the data in the Postfix module like this as well as set an empty hash as our default data.

modules/postfix/manifests/data.pp

class postfix::data {
  $relays = hiera('postfix_relays',{})
}

We ... (more)

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2013-01-15 15:22:10 -0500

Seen: 3,571 times

Last updated: Jan 16 '13