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.

51 lines
1.4KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=sls
  3. {%- set tplroot = tpldir.split('/')[0] %}
  4. {%- set sls_package_clean = tplroot ~ '.package.clean' %}
  5. {%- set sls_service_clean = tplroot ~ '.service.clean' %}
  6. {%- from tplroot ~ "/map.jinja" import apache with context %}
  7. include:
  8. - {{ sls_service_clean }}
  9. {%- set existing_states = salt['cp.list_states']() %}
  10. {%- for module in salt['pillar.get']('apache:modules:disabled', []) %}
  11. apache-config-modules-{{ module }}-disable:
  12. {%- if grains['os_family']=="Debian" %}
  13. cmd.run:
  14. - name: a2dismod -f {{ module }}
  15. - onlyif: ls {{ apache.moddir }}/{{ module }}.load
  16. {%- elif grains.os_family in ('Redhat', 'Arch') %}
  17. cmd.run:
  18. - name: find /etc/httpd/ -name '*.conf' -type f -exec sed -i -e 's/\(^\s*LoadModule.{{ module }}_module\)/#\1/g' {} \;
  19. - onlyif:
  20. - test -d /etc/httpd
  21. - {{ grains.os_family in ('Arch',) and 'true' }} || (httpd -M 2> /dev/null |grep "[[:space:]]{{ module }}_module")
  22. file.absent:
  23. - name: /etc/httpd/conf.modules.d/*{{ module }}.conf
  24. {%- elif salt['grains.get']('os_family') == 'Suse' %}
  25. cmd.run:
  26. - name: a2dismod {{ module }}
  27. - onlyif: egrep "^APACHE_MODULES=" /etc/sysconfig/apache2 | grep {{ module }}
  28. {%- else %}
  29. test.show_notification:
  30. - text: |
  31. No {{ module }} module change
  32. {%- endif %}
  33. - order: 225
  34. - require:
  35. - sls: {{ sls_service_clean }}
  36. {%- endfor %}