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

How to filter hash in puppet manifest?

$
0
0
Hi all, could you please help me. I'm getting dict from hiera in puppet manifest and then trying to filter it and pass in a python script as args.But have an issues. My hiera: myclass::server_conf: 'first_serv': 'serv_name': 'testname' 'serv_hostname': 'testhost' 'test_url': 'test@url.com' 'second_serv': 'serv_name': 'testname2' 'serv_hostname': 'testhost2' 'test_url': 'test@url.com2' My puppet manifest(i'm getting hash from values in hiera): $server_conf = hiera_hash('myclass::server_conf', {}) As result of this i had $server_conf which contain: {"first_serv"=>{"serv_name"=>"testname", "serv_hostname"=>"testhost", "test_url"=>"test@url.com"}, "second_serv"=>{"serv_name"=>"serv2", "serv_name"=>"testname2", "serv_hostname"=>"testhost2", "test_url"=>"test@url.com2"}} Then i want to select from this list only values: 'testname' 'testhost' 'test@url.com' 'testname2' 'testhost2' 'test@url.com2' I'm trying to do it using map function: $transforrmed_data = map(server_conf) |$key,$value| { $value } And getting error: Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not match |$key,$value| at /manifests/server.pp:26 on node test.node How can i solve this problem? Also I need to transfer to one more variable `'testname2' 'testhost2' 'test@url.com2'` and pass it to exec command resource. Or somehow run exec command twice with values from `first_serv` and `second_serv`. Thanks for any help!

Viewing all articles
Browse latest Browse all 6104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>