diff --git a/README.rst b/README.rst index c3d092b..fd37af5 100644 --- a/README.rst +++ b/README.rst @@ -115,6 +115,16 @@ Example Pillar: example.com: # must be unique; used as an ID declaration in Salt; also passed to the template context as {{ id }} template_file: salt://apache/vhosts/standard.tmpl +When using the provided templates, one can use a space separated list +of interfaces to bind to. For example, to bind both IPv4 and IPv6: + +.. code:: yaml + + apache: + sites: + example.com: + interface: '1.2.3.4 [2001:abc:def:100::3]' + ``apache.manage_security`` -------------------------- diff --git a/apache/vhosts/proxy.tmpl b/apache/vhosts/proxy.tmpl index f4edb85..9e8ea70 100644 --- a/apache/vhosts/proxy.tmpl +++ b/apache/vhosts/proxy.tmpl @@ -3,7 +3,7 @@ {% set sitename = site.get('ServerName', id) %} {% set vals = { - 'interface': site.get('interface', '*'), + 'interfaces': site.get('interface', '*').split(), 'port': site.get('port', '80'), 'ServerName': sitename, @@ -22,9 +22,11 @@ 'ProxyRoute': site.get('ProxyRoute', {}), } %} -Listen {{ vals.interface }}:{{ vals.port }} +{% for intf in vals.interfaces -%} +Listen {{ intf }}:{{ vals.port }} +{% endfor %} - + ServerName {{ vals.ServerName }} {% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %} diff --git a/apache/vhosts/redirect.tmpl b/apache/vhosts/redirect.tmpl index e083642..af1ccbb 100644 --- a/apache/vhosts/redirect.tmpl +++ b/apache/vhosts/redirect.tmpl @@ -3,7 +3,7 @@ {% set sitename = site.get('ServerName', id) %} {% set vals = { - 'interface': site.get('interface', '*'), + 'interfaces': site.get('interface', '*').split(), 'port': site.get('port', '80'), 'ServerName': sitename, @@ -23,9 +23,11 @@ } %} -Listen {{ vals.interface }}:{{ vals.port }} +{% for intf in vals.interfaces -%} +Listen {{ intf }}:{{ vals.port }} +{% endfor %} - + ServerName {{ vals.ServerName }} {% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %} diff --git a/apache/vhosts/standard.tmpl b/apache/vhosts/standard.tmpl index 89ebc4b..af58923 100644 --- a/apache/vhosts/standard.tmpl +++ b/apache/vhosts/standard.tmpl @@ -3,7 +3,7 @@ {% set sitename = site.get('ServerName', id) %} {% set vals = { - 'interface': site.get('interface', '*'), + 'interfaces': site.get('interface', '*').split(), 'port': site.get('port', '80'), 'ServerName': sitename, @@ -38,9 +38,11 @@ }, } %} -Listen {{ vals.interface }}:{{ vals.port }} +{% for intf in vals.interfaces -%} +Listen {{ intf }}:{{ vals.port }} +{% endfor %} - + ServerName {{ vals.ServerName }} {% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %}