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.

55 lines
1.4KB

  1. {% from "apache/map.jinja" import apache with context %}
  2. include:
  3. - apache
  4. libapache2-mod-pagespeed:
  5. pkg:
  6. - installed
  7. - sources:
  8. - mod-pagespeed-stable: {{ apache.mod_pagespeed_source }}
  9. {% if grains['os_family']=="Debian" %}
  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 %}