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.5KB

  1. {% from "apache/map.jinja" import apache with context %}
  2. apache:
  3. pkg.installed:
  4. - name: {{ apache.server }}
  5. group.present:
  6. - name: {{ apache.group }}
  7. - system: True
  8. user.present:
  9. - name: {{ apache.user }}
  10. - gid: {{ apache.group }}
  11. - system: True
  12. {# By default run apache service states (unless pillar is false) #}
  13. {% if salt['pillar.get']('apache:manage_service_states', True) %}
  14. service.{{apache.service_state}}:
  15. - name: {{ apache.service }}
  16. {% if apache.service_state in [ 'running', 'dead' ] %}
  17. - enable: True
  18. {% endif %}
  19. # The following states are inert by default and can be used by other states to
  20. # trigger a restart or reload as needed.
  21. apache-reload:
  22. module.wait:
  23. {% if apache.service_state in ['running'] %}
  24. - name: service.reload
  25. - m_name: {{ apache.service }}
  26. {% else %}
  27. - name: cmd.run
  28. - cmd: {{apache.custom_reload_command|default('apachectl graceful')}}
  29. - python_shell: True
  30. {% endif %}
  31. apache-restart:
  32. module.wait:
  33. {% if apache.service_state in ['running'] %}
  34. - name: service.restart
  35. - m_name: {{ apache.service }}
  36. {% else %}
  37. - name: cmd.run
  38. - cmd: {{apache.custom_reload_command|default('apachectl graceful')}}
  39. - python_shell: True
  40. {% endif %}
  41. {% else %}
  42. apache-reload:
  43. test.show_notification:
  44. - name: Skipping reload per user request
  45. - text: Pillar manage_service_states is False
  46. apache-restart:
  47. test.show_notification:
  48. - name: Skipping restart per user request
  49. - text: Pillar manage_service_states is False
  50. {% endif %}