{%- from "apache/map.jinja" import apache with context -%} | |||||
# Managed by saltstack | # Managed by saltstack | ||||
# envvars - default environment variables for apache2ctl | # envvars - default environment variables for apache2ctl | ||||
# Since there is no sane way to get the parsed apache2 config in scripts, some | # Since there is no sane way to get the parsed apache2 config in scripts, some | ||||
# settings are defined via environment variables and then used in apache2ctl, | # settings are defined via environment variables and then used in apache2ctl, | ||||
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc. | # /etc/init.d/apache2, /etc/logrotate.d/apache2, etc. | ||||
export APACHE_RUN_USER={{ salt['pillar.get']('apache:user', 'www-data') }} | |||||
export APACHE_RUN_GROUP={{ salt['pillar.get']('apache:group', 'www-data') }} | |||||
export APACHE_RUN_USER={{ apache.user }} | |||||
export APACHE_RUN_GROUP={{ apache.group }} | |||||
export APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid | export APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid | ||||
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX | export APACHE_RUN_DIR=/var/run/apache2$SUFFIX | ||||
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX | export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX |
{%- from "apache/map.jinja" import apache with context -%} | |||||
# Managed by saltstack | # Managed by saltstack | ||||
# envvars - default environment variables for apache2ctl | # envvars - default environment variables for apache2ctl | ||||
# Since there is no sane way to get the parsed apache2 config in scripts, some | # Since there is no sane way to get the parsed apache2 config in scripts, some | ||||
# settings are defined via environment variables and then used in apache2ctl, | # settings are defined via environment variables and then used in apache2ctl, | ||||
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc. | # /etc/init.d/apache2, /etc/logrotate.d/apache2, etc. | ||||
export APACHE_RUN_USER={{ salt['pillar.get']('apache:user', 'www-data') }} | |||||
export APACHE_RUN_GROUP={{ salt['pillar.get']('apache:group', 'www-data') }} | |||||
export APACHE_RUN_USER={{ apache.user }} | |||||
export APACHE_RUN_GROUP={{ apache.group }} | |||||
# temporary state file location. This might be changed to /run in Wheezy+1 | # temporary state file location. This might be changed to /run in Wheezy+1 | ||||
export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid | export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid | ||||
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX | export APACHE_RUN_DIR=/var/run/apache2$SUFFIX |
{%- from "apache/map.jinja" import apache with context -%} | |||||
# Managed by saltstack | # Managed by saltstack | ||||
# envvars - default environment variables for apache2ctl | # envvars - default environment variables for apache2ctl | ||||
APACHE_CONFDIR=/usr/local/etc/apache24 | APACHE_CONFDIR=/usr/local/etc/apache24 | ||||
export APACHE_RUN_USER={{ salt['pillar.get']('apache:user', 'www') }} | |||||
export APACHE_RUN_GROUP={{ salt['pillar.get']('apache:group', 'www') }} | |||||
export APACHE_RUN_USER={{ apache.user }} | |||||
export APACHE_RUN_GROUP={{ apache.group }} | |||||
export APACHE_RUN_DIR={{ salt['pillar.get']('apache:run_dir', '/var/run') }} | export APACHE_RUN_DIR={{ salt['pillar.get']('apache:run_dir', '/var/run') }} | ||||
## The locale used by some modules like mod_dav | ## The locale used by some modules like mod_dav |
apache: | apache: | ||||
pkg.installed: | pkg.installed: | ||||
- name: {{ apache.server }} | - name: {{ apache.server }} | ||||
group.present: | |||||
- name: {{ apache.group }} | |||||
- system: True | |||||
user.present: | |||||
- name: {{ apache.user }} | |||||
- gid: {{ apache.group }} | |||||
- system: True | |||||
service.running: | service.running: | ||||
- name: {{ apache.service }} | - name: {{ apache.service }} | ||||
- enable: True | - enable: True |
'Gentoo': { | 'Gentoo': { | ||||
'server': 'www-servers/apache', | 'server': 'www-servers/apache', | ||||
'service': 'apache2', | 'service': 'apache2', | ||||
'user': 'apache', | |||||
'group': 'apache', | |||||
'configfile': '/etc/apache2/httpd.conf', | 'configfile': '/etc/apache2/httpd.conf', | ||||
'mod_wsgi': 'www-apache/mod_wsgi', | 'mod_wsgi': 'www-apache/mod_wsgi', | ||||
'Debian': { | 'Debian': { | ||||
'server': 'apache2', | 'server': 'apache2', | ||||
'service': 'apache2', | 'service': 'apache2', | ||||
'user': 'www-data', | |||||
'group': 'www-data', | |||||
'configfile': '/etc/apache2/apache2.conf', | 'configfile': '/etc/apache2/apache2.conf', | ||||
'portsfile': '/etc/apache2/ports.conf', | 'portsfile': '/etc/apache2/ports.conf', | ||||
'RedHat': { | 'RedHat': { | ||||
'server': 'httpd', | 'server': 'httpd', | ||||
'service': 'httpd', | 'service': 'httpd', | ||||
'user': 'apache', | |||||
'group': 'apache', | |||||
'configfile': '/etc/httpd/conf/httpd.conf', | 'configfile': '/etc/httpd/conf/httpd.conf', | ||||
'mod_wsgi': 'mod_wsgi', | 'mod_wsgi': 'mod_wsgi', | ||||
'Suse': { | 'Suse': { | ||||
'server': 'apache2', | 'server': 'apache2', | ||||
'service': 'apache2', | 'service': 'apache2', | ||||
'user': 'apache', | |||||
'group': 'apache', | |||||
'configfile': '/etc/apache2/httpd.conf', | 'configfile': '/etc/apache2/httpd.conf', | ||||
'mod_wsgi': 'apache2-mod_wsgi', | 'mod_wsgi': 'apache2-mod_wsgi', | ||||
'FreeBSD': { | 'FreeBSD': { | ||||
'server': 'apache22', | 'server': 'apache22', | ||||
'service': 'apache22', | 'service': 'apache22', | ||||
'user': 'www', | |||||
'group': 'www', | |||||
'configfile': '/usr/local/etc/apache22/httpd.conf', | 'configfile': '/usr/local/etc/apache22/httpd.conf', | ||||
'portsfile': '/usr/local/etc/apache22/ports.conf', | 'portsfile': '/usr/local/etc/apache22/ports.conf', | ||||
file: | file: | ||||
- directory | - directory | ||||
- makedirs: true | - makedirs: true | ||||
- user: {{ salt['pillar.get']('apache:user', 'www-data') }} | |||||
- group: {{ salt['pillar.get']('apache:group', 'www-data') }} | |||||
- user: {{ apache.user }} | |||||
- group: {{ apache.group }} | |||||
- require: | - require: | ||||
- pkg: libapache2-mod-pagespeed | - pkg: libapache2-mod-pagespeed | ||||
- user: {{ salt['pillar.get']('apache:user', 'www-data') }} | |||||
- group: {{ salt['pillar.get']('apache:group', 'www-data') }} | |||||
- user: {{ apache.user }} | |||||
- group: {{ apache.group }} | |||||
{% endfor %} | {% endfor %} | ||||
# Here we hardcode a logrotate entry to take care of the logs | # Here we hardcode a logrotate entry to take care of the logs |
lookup: | lookup: | ||||
server: apache2 | server: apache2 | ||||
service: apache2 | service: apache2 | ||||
user: some_system_user | |||||
group: some_system_group | |||||
vhostdir: /etc/apache2/sites-available | vhostdir: /etc/apache2/sites-available | ||||
confdir: /etc/apache2/conf.d | confdir: /etc/apache2/conf.d |