I am trying to learn puppet and I can not understand how I can setup template erb to choose default value if variable is not defined in common.yaml or in node.yaml. This is what I have tried: 1)
# we don't need to run the embedded HTTP server here
<% if @elasticsearch_http_enabled %>
elasticsearch_http_enabled = <%= @elasticsearch_http_enabled %>
<% else %>
#elasticsearch_http_enabled = false
<% end %>
2)
# we don't need to run the embedded HTTP server here
<%- if @elasticsearch_http_enabled then -%>
elasticsearch_http_enabled = <%= @elasticsearch_http_enabled %>
<% else %>
#elasticsearch_http_enabled = false
<% end %>
3)
# we don't need to run the embedded HTTP server here
<% if @elasticsearch_http_enabled then %>
elasticsearch_http_enabled = <%= @elasticsearch_http_enabled %>
<% else %>
#elasticsearch_http_enabled = false
<% end %>
When I tried these I got error:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item gl2_srv_elasticsearch_http_enabled in any Hiera data file and no default supplied at /etc/puppet/envs/testing/modules/graylog2/manifests/server.pp:28 on node
How can I make it so if I do not define the variable it puts the default variable to the config.