Skip to content

Commit

Permalink
Support for pagespeed in vhosting configs (#39)
Browse files Browse the repository at this point in the history
* Support for pagespeed in vhosting configs

* Rename pagespeed module for nginx
  • Loading branch information
syphernl committed Sep 26, 2017
1 parent aec9fcf commit 1393189
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ vhosting:

# Enable LetsEncrypt support
#letsencrypt: True

# Enable PageSpeed support
#pagespeed: True
config:
php:
# Put in the section names (if required) and insert the config like so:
Expand Down Expand Up @@ -85,6 +88,29 @@ vhosting:
# http2: True
# letsencrypt: True

# Pagespeed example
#pagespeed-example.com:
# pagespeed:
# enable: True

# Pagespeed example with different cache path
#pagespeed-example-path.com:
# pagespeed:
# enable: True
# file_cache_path: '/tmp/pagespeed'

# Pagespeed example with specific config
#pagespeed-example-config.com:
# pagespeed:
# enable: True
# config:
# DisableFilters: 'rewrite_images,combine_css'

# Add extra config to the location section (nginx only)
extra-location-config.com:
extra_location_config:
- 'root /var/www/another;'

# Default vhost with special directory structure
deployable.com:
deploy_structure: True
Expand Down
3 changes: 3 additions & 0 deletions vhosting/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ def run():
if __salt__['pillar.get']('vhosting:server:letsencrypt', False) == True:
packages.append('vhosting.letsencrypt')

if __salt__['pillar.get']('vhosting:server:pagespeed', False) == True:
packages.append('vhosting.pagespeed')

return {'include': packages}
15 changes: 15 additions & 0 deletions vhosting/pagespeed.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Install pagespeed module
{%- set webserver = salt['pillar.get']('vhosting:server:webserver', 'nginx') %}

{%- if webserver == 'nginx' %}
{%- set pkg_name = 'nginx-module-pagespeed' %}
{%- else %}
{%- set pkg_name = 'libapache2-mod-pagespeed' %}
{%- endif %}

# Install pagespeed module
pagespeed_module:
pkg.installed:
- name: {{ pkg_name }}
- require_in:
- pkg: {{ webserver }}

0 comments on commit 1393189

Please sign in to comment.