Saltstack Official Apache Formula
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

running.sls 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # -*- coding: utf-8 -*-
  2. # vim: ft=sls
  3. {%- set tplroot = tpldir.split('/')[0] %}
  4. {%- set sls_config_file = tplroot ~ '.config.file' %}
  5. {%- set sls_config_registersite = tplroot ~ '.config.register_site' %}
  6. {%- from tplroot ~ "/map.jinja" import apache with context %}
  7. include:
  8. - {{ sls_config_file }}
  9. - {{ sls_config_registersite }}
  10. apache-service-running:
  11. {%- if salt['pillar.get']('apache:manage_service_states', True) %}
  12. {# By default run apache service states (unless pillar is false) #}
  13. service.running:
  14. - name: {{ apache.service.name }}
  15. - enable: True
  16. - retry: {{ apache.retry_option|json }}
  17. cmd.run:
  18. - names:
  19. - journalctl -xe -u {{ apache.service.name }} || tail -20 /var/log/messages || true
  20. - (service {{ apache.service.name }} restart && service {{ apache.service.name }} status) || true
  21. - cat {{ apache.config }}
  22. - onfail:
  23. - service: apache-service-running
  24. {%- endif %}
  25. {# The following states are by default inert and can be used #}
  26. {# by other states to trigger a restart or reload as needed. #}
  27. apache-service-running-restart:
  28. module.wait:
  29. {%- if apache.service_state in ['running'] %}
  30. - name: service.restart
  31. - m_name: {{ apache.service.name }}
  32. {%- else %}
  33. - name: cmd.run
  34. - cmd: {{ apache.custom_reload_command|default('apachectl graceful') }}
  35. - python_shell: True
  36. {%- endif %}
  37. - after:
  38. - service: apache-service-running
  39. apache-service-running-reload:
  40. module.wait:
  41. {%- if apache.service_state in ['running'] %}
  42. - name: service.reload
  43. - m_name: {{ apache.service.name }}
  44. {%- else %}
  45. - name: cmd.run
  46. - cmd: {{ apache.custom_reload_command|default('apachectl graceful') }}
  47. - python_shell: True
  48. {%- endif %}
  49. - after:
  50. - service: apache-service-running