if anyone needs , managed to do it like this
<% @worker_list.each do |name, content| -%>
<% if (content['type']) %>worker.<%= name %>.type=<%= content['type'] %><%
end %>
<% if (content['port']) %>worker.<%= name %>.port=<%= content['port'] %><%
end %>
<% if (content['host']) %>worker.<%= name %>.host=<%= content['host'] %><%
end %>
<% if (content['socket_keepalive']) %>worker.<%= name
%>.socket_keepalive=<%= content['socket_keepalive'] %><% end %>
<% if (content['ping_mode']) %>worker.<%= name %>.ping_mode=<%=
content['ping_mode'] %><% end %>
<% if (content['ping_timeout']) %>worker.<%= name %>.ping_timeout=<%=
content['ping_timeout'] %><% end %>
<% if (content['lbfactor']) %>worker.<%= name %>.lbfactor=<%=
content['lbfactor'] %><% end %>
<% if (content['balanced_workers']) %>worker.<%= name
%>.balanced_workers=<%= content['balanced_workers'] %><% end %>
<% if (content['sticky_session']) %>worker.<%= name %>.sticky_session=<%=
content['sticky_session'] %><% end %>
<% end -%>
On Monday, 17 July 2017 10:28:58 UTC+1, João Matos wrote:
>
> Hi all
>
> this isnt working . I dont know why. Can you help please?
>
> message
> Error: Could not retrieve catalog from remote server: Error 500 on SERVER:
> Internal Server Error: org.jruby.exceptions.RaiseException: (SyntaxError)
> /etc/puppetlabs/code/environments/teg17_uat/modules/apache/templates/confd/workers.properties.erb:14:
>
> syntax error, unexpected end-of-file
> _erbout.force_encoding(__ENCODING__)
>
>
>
> puppet code:
>
> if $worker_list != undef { file { 'workers.properties':
> ensure => file, path =>
> "${::apache::conf_dir}/workers.properties", mode =>
> $::apache::file_mode, content =>
> template('apache/confd/workers.properties.erb'), notify =>
> Class['apache::service'], } }
>
>
>
>
> template
>
> #workersworker.list=<%= @worker_list.sort_by {|key, v| key}.map{|key, v|
> key}.join(',') -%><% @worker_list.each do |name, content| -%>worker.<%= name
> %>.type=<%= content['type'] %>worker.<%= name %>.port=<%= content['port']
> %>worker.<%= name %>.host=<%= content['host'] %>worker.<%= name
> %>.socket_keepalive=<%= content['socket_keepalive'] %>worker.<%= name
> %>.ping_mode=<%= content['ping_mode'] %><% if @lbfactor -%>worker.<%= name
> %>.lbfactor=<%= content['lbfactor'] %><% end %><% if @balanced_workers
> -%>worker.<%= name %>.balanced_workers=<%= content['balanced_workers'] %><%
> end %><% if @sticky_session -%>worker.<%= name %>.sticky_session=<%=
> content['sticky_session'] %><% end %><% end -%>
>
>
>
> eg data from hiera:
>
> cncblaspringfield: type: ajp13 port: 8017 host:
> vlspringfield.com socket_keepalive: true ping_mode: A
> ping_timeout: 60000 lbfactor: 1 cncdbla_loadbalancer: type:
> lb balanced_workers: "cncbla_dover,cncblaspringfield"
> sticky_session: 1
>
>
> Note: the idea is to apply the last 3 only if the last 3 variables (
> lbfactor , etc) have content.
>
>
> Tks in advance!
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/d69ee33c-2e90-4059-8e96-aaad61772b65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.