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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. {% if grains['os_family']=="Debian" %}
  2. include:
  3. - apache
  4. {% for module in salt['pillar.get']('apache:modules:enabled', []) %}
  5. a2enmod {{ module }}:
  6. cmd.run:
  7. - unless: ls /etc/apache2/mods-enabled/{{ module }}.load
  8. - order: 225
  9. - require:
  10. - pkg: apache
  11. - watch_in:
  12. - module: apache-restart
  13. - require_in:
  14. - module: apache-restart
  15. - module: apache-reload
  16. - service: apache
  17. {% endfor %}
  18. {% for module in salt['pillar.get']('apache:modules:disabled', []) %}
  19. a2dismod -f {{ module }}:
  20. cmd.run:
  21. - onlyif: ls /etc/apache2/mods-enabled/{{ module }}.load
  22. - order: 225
  23. - require:
  24. - pkg: apache
  25. - watch_in:
  26. - module: apache-restart
  27. - require_in:
  28. - module: apache-restart
  29. - module: apache-reload
  30. - service: apache
  31. {% endfor %}
  32. {% elif grains['os_family']=="RedHat" %}
  33. include:
  34. - apache
  35. {% for module in salt['pillar.get']('apache:modules:enabled', []) %}
  36. find /etc/httpd/ -name '*.conf' -type f -exec sed -i -e 's/\(^#\)\(\s*LoadModule.{{ module }}_module\)/\2/g' {} \;:
  37. cmd.run:
  38. - unless: httpd -M 2> /dev/null | grep "[[:space:]]{{ module }}_module"
  39. - order: 225
  40. - require:
  41. - pkg: apache
  42. - watch_in:
  43. - module: apache-restart
  44. - require_in:
  45. - module: apache-restart
  46. - module: apache-reload
  47. - service: apache
  48. {% endfor %}
  49. {% for module in salt['pillar.get']('apache:modules:disabled', []) %}
  50. find /etc/httpd/ -name '*.conf' -type f -exec sed -i -e 's/\(^\s*LoadModule.{{ module }}_module\)/#\1/g' {} \;:
  51. cmd.run:
  52. - onlyif: httpd -M 2> /dev/null | grep "[[:space:]]{{ module }}_module"
  53. - order: 225
  54. - require:
  55. - pkg: apache
  56. - watch_in:
  57. - module: apache-restart
  58. - require_in:
  59. - module: apache-restart
  60. - module: apache-reload
  61. - service: apache
  62. {% endfor %}
  63. {% elif salt['grains.get']('os_family') == 'Suse' or salt['grains.get']('os') == 'SUSE' %}
  64. include:
  65. - apache
  66. {% for module in salt['pillar.get']('apache:modules:enabled', []) %}
  67. a2enmod {{ module }}:
  68. cmd.run:
  69. - unless: egrep "^APACHE_MODULES=" /etc/sysconfig/apache2 | grep {{ module }}
  70. - order: 225
  71. - require:
  72. - pkg: apache
  73. - watch_in:
  74. - module: apache-restart
  75. - require_in:
  76. - module: apache-restart
  77. - module: apache-reload
  78. - service: apache
  79. {% endfor %}
  80. {% for module in salt['pillar.get']('apache:modules:disabled', []) %}
  81. a2dismod -f {{ module }}:
  82. cmd.run:
  83. - onlyif: egrep "^APACHE_MODULES=" /etc/sysconfig/apache2 | grep {{ module }}
  84. - order: 225
  85. - require:
  86. - pkg: apache
  87. - watch_in:
  88. - module: apache-restart
  89. - require_in:
  90. - module: apache-restart
  91. - module: apache-reload
  92. - service: apache
  93. {% endfor %}
  94. {% endif %}