Manage ports.conf file on Debian
This commit is contained in:
parent
ba6679ef66
commit
4d04d95b02
@ -32,6 +32,19 @@ include:
|
||||
- pkg: apache
|
||||
- watch_in:
|
||||
- service: apache
|
||||
|
||||
{{ apache.portsfile }}:
|
||||
file.managed:
|
||||
- template: jinja
|
||||
- source:
|
||||
- salt://apache/files/{{ salt['grains.get']('os_family') }}/ports-{{ apache.version }}.conf.jinja
|
||||
- require:
|
||||
- pkg: apache
|
||||
- watch_in:
|
||||
- service: apache
|
||||
- context:
|
||||
apache: {{ apache }}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if grains['os_family']=="RedHat" %}
|
||||
|
30
apache/files/Debian/ports-2.4.conf.jinja
Normal file
30
apache/files/Debian/ports-2.4.conf.jinja
Normal file
@ -0,0 +1,30 @@
|
||||
{%- from "apache/map.jinja" import apache with context -%}
|
||||
|
||||
# Managed by saltstack
|
||||
|
||||
{% if salt['pillar.get']('apache:sites') is mapping %}
|
||||
{%- set listen_directives = [] %}
|
||||
{%- for id, site in salt['pillar.get']('apache:sites').items() %}
|
||||
{%- set interfaces = site.get('interface', '*').split() %}
|
||||
{%- set port = site.get('port', 80) %}
|
||||
{%- for interface in interfaces %}
|
||||
{%- set listen_directive = interface ~ ':' ~ port %}
|
||||
{%- if listen_directive not in listen_directives %}
|
||||
{%- do listen_directives.append(listen_directive) %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
{%- for listen in listen_directives %}
|
||||
Listen {{ listen }}
|
||||
{%- endfor %}
|
||||
{%- else %}
|
||||
Listen 80
|
||||
|
||||
<IfModule mod_ssl.c>
|
||||
Listen 443
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_gnutls.c>
|
||||
Listen 443
|
||||
</IfModule>
|
||||
{%- endif %}
|
@ -5,6 +5,7 @@
|
||||
'server': 'apache2',
|
||||
'service': 'apache2',
|
||||
'configfile': '/etc/apache2/apache2.conf',
|
||||
'portsfile': '/etc/apache2/ports.conf',
|
||||
|
||||
'mod_wsgi': 'libapache2-mod-wsgi',
|
||||
'mod_php5': 'libapache2-mod-php5',
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
include:
|
||||
- apache
|
||||
- apache.config
|
||||
|
||||
{% for id, site in salt['pillar.get']('apache:sites', {}).items() %}
|
||||
{% set documentroot = site.get('DocumentRoot', '{0}/{1}'.format(apache.wwwdir, id)) %}
|
||||
|
Loading…
Reference in New Issue
Block a user