Hello, I try to customize my http vhost template and defined and array of ip addresses in the manifests:
class apache::webservice( $htdocs = $apache::param::htdocs, $apacheuser = $apache::param::apacheuser, $apachegroup = $apache::param::apachegroup, $logdir = $apache::param::logdir, ) inherits apache::param{ $sitename = "service.de" file{"$logdir/$sitename": ensure => directory, } apache::vhost {"app $name": template => 'apache/vhost-proxypass.conf.erb', port => 80, servername => "$sitename", modsec => "", pptarget => "10.18.10.10", ppproto => "http", ppport => "8080", ppoptions => "", ppexception => "", logformat => "combined_forwarded", rewrite => "webservice", ip => ["10.18.10."], ip_xforward => ["75.2.91.24", "94.5.52.252", ], } } In my template I try to use the array ip_xforward to put those ip adresses in a variable and allow them: <% if @rewrite != '' && @ip != '' || @ip_xforward != '' %> <Location /<%= @rewrite %>> <% if @ip_xforward != '' %> <% if ip.is_a? Array -%> <% ip_xforward.each do |name| -%><%= "\t\tSetEnvIF X-Forwarded-For ^(#{name}) AllowIP\n" %><% end -%> <% elsif @ip_xforward != '' -%> <%= " SetEnvIF X-Forwarded-For ^(#{ip_xforward}) AllowIP" -%> <% end -%> <% end -%> Order deny,allow Deny from all Allow from env=AllowIP <% if @ip != '' %> <% if ip.is_a? Array -%> <% ip.each do |name| -%><%= "Allow from #{name}\n" %><% end -%> <% elsif @ip != '' -%> <%= " Allow from #{ip}" -%> <% end -%> <% end -%> </Location> <% end %> My problem is that I have to escape the dot's in the ip address because it's a regex. It should look like SetEnvIF X-Forwarded-For ^(94\.20\.18\.9) AllowIP But actually it look like this: SetEnvIF X-Forwarded-For ^(94.20.18.9) AllowIP I tried it with regsubst, but without success: <% ip_xforward.each do |name| -%><%= "\t\tSetEnvIF X-Forwarded-For ^(regsubst(#{name}, '\.','\\.')) AllowIP\n" %><% end -%> -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/ba298552-d752-4db5-930a-7aa2515ffc39%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.