Saltstack Official Apache Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

53 rindas
1.5KB

  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_dead = tplroot ~ '.service.clean' %}
  6. {%- from tplroot ~ "/map.jinja" import apache with context %}
  7. include:
  8. - {{ sls_service_dead }}
  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_dead }}
  36. - require_in:
  37. - pkg: apache-package-clean-pkg-removed
  38. {%- endfor %}