Ask Your Question

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 -0600

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 = [
-%> my_cluster <%= @fqdn %> ["<%= $elasticsearch_servers.join('", "') %>"]
bootstrap.memory_lock: true
discovery.zen.minimum_master_nodes: 2 <%= @ipaddress_ens160 %>
edit retag flag offensive close merge delete


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.

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

1 Answer

Sort by ยป oldest newest most voted

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

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.


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


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

Seen: 70 times

Last updated: Feb 25