Ask Your Question
0

create multiple parameters in config file based on variable array

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

johntest gravatar image

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

What I have is something like this

puppet variables

$ipnode1 = '1.2.3.4',
$ip
node2 = '1.2.3.5',
$ip_node3 = '1.2.3.6',

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.

Update

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
1.2.3.4:4545

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
0

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

johntest gravatar image

I found the way using arrays

$servers = [ '1.2.3.4', '1.2.3.5', '1.2.3.6'],

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

Stats

Asked: 2015-11-03 13:27:27 -0500

Seen: 112 times

Last updated: Nov 03 '15