How to reuse varibale from hiera hash as another hiera variable?

asked 2016-10-07 08:09:00 -0500

admont gravatar image

Lets say I have

# hash
some_application::users:
    some_user:
        username: 'some_username'
        password: 'some_password'
    another_user:
        username: 'another_username'
        password: 'another_password'

And I want to reuse these variables in Hiera:

# hash
another_application::users:
    some_user:
        username: "%{hiera('some_application::users')['some_user']['username']}"
    another_user:
        username: "%{hiera('some_application::users')['another_user']['username']}"

This kind of definition work from console:

puppet apply -e "notice(hiera('some_application::users')['some_user']['username'])"

But not from Hiera. What is the correct syntax to reuse variable from Hiera hash?

edit retag flag offensive close merge delete