Init.pp query help

asked 2018-04-25 11:31:41 -0600

tronyx gravatar image

Running Puppet 4 w/ Hiera 5. I have the following in my init.pp file:

$query_es_nodes = query_nodes("(class['ee_elasticsearch'] and datacenter=${::datacenter} and env=${::env} and env_num='${::env_num}' \
and fqdn~${es_name})")
$es_masters = parsejson(inline_template("[<%= @query_es_nodes.map{
  |host|
    \"\\\"\" + host + \":9300\\\"\"
  }.flatten.join(', ')
  %>]"
))

This winds up generating just '' in the elasticsearch.yml file on the Hosts with the following used within the YAML file:

discovery:
    zen:
      ping:
        unicast:
          hosts: "[%{es_masters}]"

When I run the same on one of the Puppet Masters it generates the list of hosts as expected. I'm not sure if it's all of the additional code to create the list that is problematic or what, but I'm starting to pull out what little hair I have left over this. Any/all help is greatly appreciated.

edit retag flag offensive close merge delete