Browse Source

vhosts/standard: rewrite, simplify code

* No more if.
* Allow lookup to set default value for all docroot
* updated pillar.example
tags/v0.37.4
Adrien "ze" Urban 6 years ago
parent
commit
37f8af4b3a
2 changed files with 9 additions and 8 deletions
  1. +2
    -6
      apache/vhosts/standard.sls
  2. +7
    -2
      pillar.example

+ 2
- 6
apache/vhosts/standard.sls View File

file.directory: file.directory:
- name: {{ documentroot }} - name: {{ documentroot }}
- makedirs: True - makedirs: True
{% if site.get('DocumentRootUser') %}
- user: {{ site.DocumentRootUser }}
{% endif %}
{% if site.get('DocumentRootGroup') %}
- group: {{ site.DocumentRootGroup }}
{% endif %}
- user: {{ site.get('DocumentRootUser', apache.get('document_root_user'))|json }}
- group: {{ site.get('DocumentRootGroup', apache.get('document_root_group'))|json }}
- allow_symlink: True - allow_symlink: True
{% endif %} {% endif %}



+ 7
- 2
pillar.example View File

# Default value for AddDefaultCharset in RedHat configuration # Default value for AddDefaultCharset in RedHat configuration
default_charset: 'UTF-8' default_charset: 'UTF-8'


# Should we enforce DocumentRoot user/group?
# Default: do not enforce
document_root_user: www-data # Force user if specified, leave it default if not
document_root_group: null # Do not enforce group

global: global:
# global apache directives # global apache directives
AllowEncodedSlashes: 'On' AllowEncodedSlashes: 'On'
CustomLog: /path/to/logs/example.com-access.log # E.g.: /var/log/apache2/example.com-access.log CustomLog: /path/to/logs/example.com-access.log # E.g.: /var/log/apache2/example.com-access.log


DocumentRoot: /path/to/www/dir/example.com # E.g., /var/www/example.com DocumentRoot: /path/to/www/dir/example.com # E.g., /var/www/example.com
DocumentRootUser: www-data # Force user if specified, leave it default if not
DocumentRootGroup: www-data # Force group if specified, leave it default if not
DocumentRootUser: null # do not enforce user, defaults to lookup:document_root_user
DocumentRootGroup: www-data # Force group, defaults to lookup:document_root_group


SSLCertificateFile: /etc/ssl/mycert.pem # if ssl is desired SSLCertificateFile: /etc/ssl/mycert.pem # if ssl is desired
SSLCertificateKeyFile: /etc/ssl/mycert.pem.key # if key for cert is needed or in an extra file SSLCertificateKeyFile: /etc/ssl/mycert.pem.key # if key for cert is needed or in an extra file

Loading…
Cancel
Save