Ask Your Question
0

Local variable in .ERB file works during first run but won't update if list value is changed on consecutive runs

asked 2018-02-23 04:16:11 -0500

sfcg gravatar image

Hi all,

New here so forgive me if I'm asking something that has been asked. I looked around and could not find any information on it specifically.

I'm building out an elasticsearch test cluster. When I do the initial run, the elasticsearch.yml file is updated and the elasticsearch_servers variable joins the list fine, but if I add a server to that list, on consecutive runs, they are not added to the file.

I'm also using this list to generate firewall rules so it's used in multiple places.

Org is currently stuck on puppet 3 so no EPP for us :(

Below is the example ERB.

<%
# List of elasticsearch servers.
$elasticsearch_servers = [
  'es-cluster-dev01.fqdn',
  'es-cluster-dev02.fqdn',
  'es-cluster-dev03.fqdn',
  'es-cluster-dev04.fqdn',
  'es-cluster-dev05.fqdn',
  'es-cluster-dev06.fqdn',
  'es-cluster-dev07.fqdn',
  'es-cluster-dev08.fqdn',
]
-%>

cluster.name: my_cluster
node.name: <%= @fqdn %>
http.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["<%= $elasticsearch_servers.join('", "') %>"]
bootstrap.memory_lock: true
discovery.zen.minimum_master_nodes: 2
transport.host: 0.0.0.0
network.host: <%= @ipaddress_ens160 %>
edit retag flag offensive close merge delete

Comments

Are you using the replace parameter on your file resource? The ERB itself doesn't determine if the file gets updated, that just generates a string. You can test it by putting the result of template($mytmp) in a notify. https://puppet.com/docs/puppet/5.3/types/file.html#file-attribute-replace

DarylW gravatar imageDarylW ( 2018-02-23 10:29:15 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-02-25 10:52:38 -0500

sfcg gravatar image

Okay, I'm a bit of a dope.

It turns out I removed my module from the hosts in question for some reason. When reapplying the module it updates the file fine.

Thanks!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-02-23 04:16:11 -0500

Seen: 51 times

Last updated: Feb 25