Hiera single key/value lookup and create_resources for augeas

60 views
Skip to first unread message

julie...@dayotech.fr

unread,
May 4, 2015, 11:13:10 AM5/4/15
to puppet...@googlegroups.com
Hi

I want to manage an INI file with an undefined number of key/value records.
I wish to add each var/value recording in a single file (manage by augeas) for each project, but I don't know how to make calls or pass the data to create_resources.
Don't want to have a hash for each var/value, too boring to manage.

So here's the Hiera file I write :
---
my_variables:
  my_project1:
    var1:value1
    var2:value2
  my_project2:
    var1:value1
    var2:value2


Any idea ?

Thanks.

Felix Frank

unread,
May 13, 2015, 9:03:51 AM5/13/15
to puppet...@googlegroups.com
Well you will have to devise a defined type that takes the variable name
as the resource title, and the value as an argument. Data structure has
to be

my_variables:
my_project1:
var1:
value: value1
var2:
value: value2

Then the my_project1 hash is eligible for use with create_resources.

With Puppet 4 you can use iteration over the hash instead, so that no
data restructuring is necessary. If you are on a recent version of
Puppet 3, you can do the same thing using the parser=future setting.

HTH,
Felix
Reply all
Reply to author
Forward
0 new messages