Skip to content

Commit

Permalink
Merge branch 'OpenSides-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
alxwr committed May 17, 2017
2 parents 475fb83 + 69bb774 commit c341b92
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 4 deletions.
20 changes: 20 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ Enables the Apache module mod_proxy. (Debian and FreeBSD only)

Enables the Apache module mod_proxy_http and requires the Apache module mod_proxy to be enabled. (Debian Only)

``apache.mod_proxy_fcgi``
-------------------------

Enables the Apache module mod_proxy_fcgi and requires the Apache module mod_proxy to be enabled. (Debian Only)

``apache.mod_wsgi``
-------------------

Expand Down Expand Up @@ -100,6 +105,11 @@ Enables mod_cgi. (FreeBSD only)

Installs and enables the mod_fcgid module

``apache.mod_fastcgi``
--------------------

Installs and enables the mod_fastcgi module

``apache.mod_dav_svn``
--------------------

Expand Down Expand Up @@ -144,6 +154,11 @@ Enables the Apache module vhost_alias (Debian Only)

Enables and configures the Apache module mod_remoteip using data from Pillar. (Debian Only)

``apache.mod_xsendfile``
----------------------

Installs and enables mod_xsendfile module. (Debian Only)

``apache.own_default_vhost``
--------------------------

Expand Down Expand Up @@ -188,6 +203,11 @@ Configures Apache's security.conf options by reassinging them using data from Pi

Installs and configures Apache on Debian and Ubuntu systems.

``apache.uninstall``
----------

Stops the Apache service and uninstalls the package.

These states are ordered using the ``order`` declaration. Different stages
are divided into the following number ranges:

Expand Down
1 change: 1 addition & 0 deletions apache/config.sls
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include:
{{ apache.vhostdir }}:
file.directory:
- makedirs: True
- require:
- pkg: apache
- watch_in:
Expand Down
3 changes: 3 additions & 0 deletions apache/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
'mod_perl2': 'libapache2-mod-perl2',
'mod_fcgid': 'libapache2-mod-fcgid',
'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb',
'mod_xsendfile': 'libapache2-mod-xsendfile',
'mod_fastcgi': 'libapache2-mod-fastcgi',

'vhostdir': '/etc/apache2/sites-available',
'confdir': '/etc/apache2/conf.d',
Expand All @@ -54,6 +56,7 @@
'configfile': '/etc/httpd/conf/httpd.conf',

'mod_wsgi': 'mod_wsgi',
'conf_mod_wsgi': '/etc/httpd/conf.d/wsgi.conf',
'mod_php5': 'php',
'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm',

Expand Down
32 changes: 32 additions & 0 deletions apache/mod_fastcgi.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% from "apache/map.jinja" import apache with context %}
include:
- apache
- apache.mod_actions
{% if grains['os_family']=="Debian" %}
mod-fastcgi:
pkg.installed:
- name: {{ apache.mod_fastcgi }}
- order: 180
- require:
- pkgrepo: repo-fastcgi
- pkg: apache
repo-fastcgi:
pkgrepo.managed:
- name: "deb http://httpredir.debian.org/debian jessie"
- file: /etc/apt/sources.list.d/non-free.list
- comps: non-free
a2enmod fastcgi:
cmd.run:
- unless: ls /etc/apache2/mods-enabled/fastcgi.load
- order: 225
- require:
- pkg: mod-fastcgi
- watch_in:
- module: apache-restart
{% endif %}
17 changes: 17 additions & 0 deletions apache/mod_proxy_fcgi.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% if grains['os_family']=="Debian" %}

include:
- apache
- apache.mod_proxy

a2enmod proxy_fcgi:
cmd.run:
- unless: ls /etc/apache2/mods-enabled/proxy_fcgi.load
- order: 225
- require:
- pkg: apache
- cmd: a2enmod proxy
- watch_in:
- module: apache-restart

{% endif %}
5 changes: 3 additions & 2 deletions apache/mod_wsgi.sls
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ mod_wsgi:
- require:
- pkg: apache
{% if grains.get('os_family') == 'RedHat' %}
/etc/httpd/conf.d/wsgi.conf:
{% if apache.conf_mod_wsgi %}
{{ apache.conf_mod_wsgi }}:
file.uncomment:
- regex: LoadModule
- onlyif: test -f {{ apache.conf_mod_wsgi }}
- require:
- pkg: mod_wsgi
{% endif %}
24 changes: 24 additions & 0 deletions apache/mod_xsendfile.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% from "apache/map.jinja" import apache with context %}
include:
- apache
mod-xsendfile:
pkg.installed:
- name: {{ apache.mod_xsendfile }}
- order: 180
- require:
- pkg: apache
{% if grains['os_family']=="Debian" %}
a2enmod xsendfile:
cmd.run:
- order: 225
- unless: ls /etc/apache2/mods-enabled/xsendfile.load
- require:
- pkg: mod-xsendfile
- watch_in:
- module: apache-restart
{% endif %}
3 changes: 2 additions & 1 deletion apache/osfingermap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Red Hat Enterprise Linux Server-6:
version: '2.2'
Red Hat Enterprise Linux Server-7:
version: '2.4'
CentOS Linux-6:
CentOS-6:
version: '2.2'
CentOS Linux-7:
version: '2.4'
conf_mod_wsgi: '/etc/httpd/conf.modules.d/10-wsgi.conf'
Oracle Linux Server-6:
version: '2.2'
Oracle Linux Server-7:
Expand Down
30 changes: 30 additions & 0 deletions apache/vhosts/minimal.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{# Define default values here so the template below can just focus on layout #}
{%- set sitename = site.get('ServerName', id) -%}

{%- set vals = {
'interfaces': site.get('interface', '*').split(),
'port': site.get('port', '80'),

'ServerName': sitename,
'ServerAlias': site.get('ServerAlias', 'www.{0}'.format(sitename)),

'ServerAdmin': site.get('ServerAdmin', 'webmaster@{0}'.format(sitename)),

'LogLevel': site.get('LogLevel', 'warn'),
'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)),
'CustomLog': site.get('CustomLog', '{0}/{1}-access.log'.format(map.logdir, sitename)),

'DocumentRoot': site.get('DocumentRoot', '{0}/{1}'.format(map.wwwdir, sitename))
} -%}

<VirtualHost {% for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
ServerName {{ vals.ServerName }}
{% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %}
{% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif %}

{% if site.get('DocumentRoot') != False -%}DocumentRoot {{ vals.DocumentRoot }}{% endif %}

{% if site.get('LogLevel') != False -%}LogLevel {{ vals.LogLevel }}{% endif %}
{% if site.get('ErrorLog') != False -%}ErrorLog {{ vals.ErrorLog }}{% endif %}
{% if site.get('CustomLog') != False -%}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %}
</VirtualHost>
2 changes: 1 addition & 1 deletion pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ apache:

example.com: # must be unique; used as an ID declaration in Salt.
enabled: True
template_file: salt://apache/vhosts/standard.tmpl # or redirect.tmpl or proxy.tmpl
template_file: salt://apache/vhosts/standard.tmpl # or minimal.tmpl or redirect.tmpl or proxy.tmpl

####################### DEFAULT VALUES BELOW ############################
# NOTE: the values below are simply default settings that *can* be
Expand Down

0 comments on commit c341b92

Please sign in to comment.