Saltstack Official Apache Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.4KB

  1. {% if grains['os_family']=="Debian" %}
  2. {% from "apache/map.jinja" import apache with context %}
  3. include:
  4. - apache
  5. libapache2-mod-pagespeed:
  6. pkg:
  7. - installed
  8. - sources:
  9. - mod-pagespeed-stable: https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
  10. a2enmod pagespeed:
  11. cmd.run:
  12. - unless: ls /etc/apache2/mods-enabled/pagespeed.load
  13. - order: 255
  14. - require:
  15. - pkg: libapache2-mod-pagespeed
  16. - watch_in:
  17. - service: apache
  18. {% for dir in ['/var/cache/mod_pagespeed', '/var/log/pagespeed'] %}
  19. {{ dir }}:
  20. file:
  21. - directory
  22. - makedirs: true
  23. - user: {{ salt['pillar.get']('apache:user', 'www-data') }}
  24. - group: {{ salt['pillar.get']('apache:group', 'www-data') }}
  25. - require:
  26. - pkg: libapache2-mod-pagespeed
  27. - user: {{ salt['pillar.get']('apache:user', 'www-data') }}
  28. - group: {{ salt['pillar.get']('apache:group', 'www-data') }}
  29. {% endfor %}
  30. # Here we hardcode a logrotate entry to take care of the logs
  31. /etc/logrorate.d/pagespeed:
  32. file:
  33. - managed
  34. - contents: |
  35. /var/log/pagespeed/*.log {
  36. weekly
  37. missingok
  38. rotate 52
  39. compress
  40. delaycompress
  41. notifempty
  42. sharedscripts
  43. postrotate
  44. if /etc/init.d/apache2 status > /dev/null ; then \
  45. /etc/init.d/apache2 reload > /dev/null; \
  46. fi;
  47. endscript
  48. }
  49. {% endif %}