Ask Your Question

create multiple parameters in config file based on variable array

asked 2015-11-03 13:27:27 -0600

johntest gravatar image

updated 2015-11-03 16:35:45 -0600

What I have is something like this

puppet variables

$ipnode1 = '',
node2 = '',
$ip_node3 = '',

config file

servers="<%= @ipnode1 %>,<%= @ipnode2 %>,<%= @ip_node3 %>"

What I want is to create a dynamic array which would sometimes have 2,3,5,9 or any number of values. Based on this array I want to have values in my config file servers parameter.


I found the solution to above, but I am looking for another one
In this case, requirement is to have a standard port number next to ip such as

What's the best way to do this without user having to type it every time next to IP in the array.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-11-03 16:31:56 -0600

johntest gravatar image

I found the way using arrays

$servers = [ '', '', ''],

in config file <% joinedservers = @servers.join(',') %><%= joinedservers %>

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: 2015-11-03 13:27:27 -0600

Seen: 144 times

Last updated: Nov 03 '15