0

I'm sure the answer to this is straightforward, but I can't find out how to do this. I have a line in my erb template file that needs to write exactly as-is into a server's config file (for OpenVPN):

push "dhcp-option DNS 192.16.23.12"

I need to change this so that the ip address gets looked up from the facter listing on the server, rather than having it hard-coded, as this conf file needs to be used on different servers now. The fact holding this ip address is "ipaddress_tun0". I've tried putting it into my line, thus:

push "dhcp-option DNS <%= @ipaddress_tun0 %>"

.. but the fact doesn't get interpolated properly, presumably because of the double quotes. Unfortunately the double quotes are needed as a literal part of the line in the conf file, so they have to be there (single quotes don't work). Can anyone advise how I can get this line to look up and insert the value of ipaddress_tun0, please?

4

1 回答 1

1
push "dhcp-option DNS <%= scope.lookupvar('ipaddress_tun0') %>"   

是需要的,因为我的事实超出了当前范围。

于 2016-04-20T09:32:16.007 回答