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

Hiera calling a parameter set in a module

$
0
0
I am wondering if it is possible or if there is a better way for having a yaml file used by Hiera to have dymanic configuration My current hiera config is as follows. :backends: - yaml :hierarchy: - "node/%{::clientcert}" - "role/%{::dec_role}" - "dc/%{::dec_dc}" - common - firewall For a role, I want to create an autofs resource however, I also want to pass in a specific parameter. Yaml file for role is as follows. autofs::mounts: icedrop: mount: /- mapfile: /etc/autofs.d/auto.ice mapcontents: '/srv/ice -fstype=cifs,noperm,credentials=/etc/autofs.d/cred/ice_flat_files %{::ice::params::ice_server}/ICE_Flat_Files' options: --timeout=600 order: 4 Note that I have tired to pass in a parameter I already have set in ice::params::ice_server However, nothing gets passed in, so it means this is a null value I assume at the moment. So my question is, can one pass a parameter into Hiera like you would with a normal class or module or can Hiera call this type of parameter. I could create node yaml file and have this set statically but would prefer to have the one role yaml file and have this working dynamically for all my servers. Hope I am clear and thanks. EDIT: To add.... The parameter ice::params::ice_server can be found in a module I have written. Note $env is a fact we have to determine the environment. class ice::params::ice_server { if $env == 'tst' { $ice_server = 'testserver03' } elsif $env == 'prd' { $ice_server = 'prodserver04' } } Setting the parameter is not an issue and calling itin side other modules is OK, I have done that many times before, but calling it in Heira is not something I have done before. Looking at the puppet documentation the syntax is supposed to be %{::ice::params::ice_server} however in my yaml file this doesn't return anything. I'm thinking do I need to inherit it somehow or perhaps the scope is wrong? Hope this makes it clearer.

Viewing all articles
Browse latest Browse all 6104

Trending Articles