Browse Source

Merge pull request #31 from abrefort/master

Fix Apache 2.4 and add support for Ubuntu 14.10
master
Nitin Madhok 10 years ago
parent
commit
82c120586a
3 changed files with 19 additions and 19 deletions
  1. +10
    -6
      apache/map.jinja
  2. +3
    -3
      apache/vhosts/standard.sls
  3. +6
    -10
      apache/vhosts/standard.tmpl

+ 10
- 6
apache/map.jinja View File

'default_site_ssl': 'default-ssl', 'default_site_ssl': 'default-ssl',
'logdir': '/var/log/apache2', 'logdir': '/var/log/apache2',
'wwwdir': '/srv', 'wwwdir': '/srv',
'require_all': False,
'use_require': False,
}, },
'RedHat': { 'RedHat': {
'server': 'httpd', 'server': 'httpd',
'default_site_ssl': 'default-ssl', 'default_site_ssl': 'default-ssl',
'logdir': '/var/log/httpd', 'logdir': '/var/log/httpd',
'wwwdir': '/var/www', 'wwwdir': '/var/www',
'require_all': False,
'use_require': False,
}, },
'FreeBSD': { 'FreeBSD': {
'server': 'apache22', 'server': 'apache22',
'default_site_ssl': 'default-ssl', 'default_site_ssl': 'default-ssl',
'logdir': '/var/log/', 'logdir': '/var/log/',
'wwwdir': '/usr/local/www/apache22/', 'wwwdir': '/usr/local/www/apache22/',
'require_all': False,
'use_require': False,
}, },
}, merge=salt['grains.filter_by']({ }, merge=salt['grains.filter_by']({
'14.04': { '14.04': {
'confext': '.conf', 'confext': '.conf',
'default_site': '000-default.conf', 'default_site': '000-default.conf',
'default_site_ssl': 'default-ssl.conf', 'default_site_ssl': 'default-ssl.conf',
'require_all': True,
'use_require': True,
},
'14.10': {
'confext': '.conf',
'default_site': '000-default.conf',
'default_site_ssl': 'default-ssl.conf',
'use_require': True,
}, },
}, grain='lsb_distrib_release', merge=salt['pillar.get']('apache:lookup'))) %} }, grain='lsb_distrib_release', merge=salt['pillar.get']('apache:lookup'))) %}



+ 3
- 3
apache/vhosts/standard.sls View File

- module: apache-reload - module: apache-reload


{% if grains.os_family == 'Debian' %} {% if grains.os_family == 'Debian' %}
a2ensite {{ id }}:
a2ensite {{ id }}{{ apache.confext }}:
cmd: cmd:
- run - run
- unless: test -f /etc/apache2/sites-enabled/{{ id }}
- unless: test -f /etc/apache2/sites-enabled/{{ id }}{{ apache.confext }}
- require: - require:
- file: {{ id }}
- file: /etc/apache2/sites-available/{{ id }}{{ apache.confext }}
- watch_in: - watch_in:
- module: apache-reload - module: apache-reload
{% endif %} {% endif %}

+ 6
- 10
apache/vhosts/standard.tmpl View File



'Directory_default': '{0}/{1}'.format(map.wwwdir, sitename), 'Directory_default': '{0}/{1}'.format(map.wwwdir, sitename),
'Directory': { 'Directory': {
'Options': '-Indexes FollowSymLinks',
'Options': '-Indexes +FollowSymLinks',
'Order': 'allow,deny', 'Order': 'allow,deny',
'Allow': 'from all', 'Allow': 'from all',
'Require': 'all granted',
'AllowOverride': 'None', 'AllowOverride': 'None',
}, },
} %} } %}
{% if site.get('DocumentRoot') != False %}DocumentRoot {{ vals.DocumentRoot }}{% endif %} {% if site.get('DocumentRoot') != False %}DocumentRoot {{ vals.DocumentRoot }}{% endif %}
{% if site.get('VirtualDocumentRoot') %}VirtualDocumentRoot {{ vals.VirtualDocumentRoot }}{% endif %} {% if site.get('VirtualDocumentRoot') %}VirtualDocumentRoot {{ vals.VirtualDocumentRoot }}{% endif %}


{% if site.get('DocumentRoot') != False %}
<Directory {{ vals.DocumentRoot }}>
{% if apache.require_all %}
Require all granted
{% endif %}
</Directory>
{% endif %}

{% for path, dir in site.get('Directory', {}).items() %} {% for path, dir in site.get('Directory', {}).items() %}
{% set dvals = { {% set dvals = {
'Options': dir.get('Options', vals.Directory.Options), 'Options': dir.get('Options', vals.Directory.Options),


<Directory "{{ path }}"> <Directory "{{ path }}">
{% if dir.get('Options') != False %}Options {{ dvals.Options }}{% endif %} {% if dir.get('Options') != False %}Options {{ dvals.Options }}{% endif %}
{% if apache.use_require %}
{% if dir.get('Require') != False %}Require {{dvals.Require}}{% endif %}
{% else %}
{% if dir.get('Order') != False %}Order {{ dvals.Order }}{% endif %} {% if dir.get('Order') != False %}Order {{ dvals.Order }}{% endif %}
{% if dir.get('Allow') != False %}Allow {{ dvals.Allow }}{% endif %} {% if dir.get('Allow') != False %}Allow {{ dvals.Allow }}{% endif %}
{% endif %}
{% if dir.get('AllowOverride') != False %}AllowOverride {{ dvals.AllowOverride }}{% endif %} {% if dir.get('AllowOverride') != False %}AllowOverride {{ dvals.AllowOverride }}{% endif %}
{% if dir.get('Require') != False %}Require {{dvals.Require}}{% endif %}


{% if dir.get('Formula_Append') %} {% if dir.get('Formula_Append') %}
{{ dir.Formula_Append|indent(8) }} {{ dir.Formula_Append|indent(8) }}

Loading…
Cancel
Save