apache-formula/apache/init.sls

58 lines
1.5 KiB
Plaintext
Raw Normal View History

{% from "apache/map.jinja" import apache with context %}
2013-08-13 23:03:16 +02:00
apache:
2014-09-25 18:48:36 +02:00
pkg.installed:
2013-08-23 05:14:28 +02:00
- name: {{ apache.server }}
group.present:
- name: {{ apache.group }}
- system: True
user.present:
- name: {{ apache.user }}
- gid: {{ apache.group }}
- system: True
{# By default run apache service states (unless pillar is false) #}
{% if salt['pillar.get']('apache:manage_service_states', True) %}
service.{{ apache.service_state }}:
2013-08-23 05:14:28 +02:00
- name: {{ apache.service }}
{% if apache.service_state in [ 'running', 'dead' ] %}
2013-08-13 23:03:16 +02:00
- enable: True
{% endif %}
# The following states are inert by default and can be used by other states to
# trigger a restart or reload as needed.
apache-reload:
2014-09-25 18:48:36 +02:00
module.wait:
{% if apache.service_state in ['running'] %}
- name: service.reload
- m_name: {{ apache.service }}
{% else %}
- name: cmd.run
- cmd: {{ apache.custom_reload_command|default('apachectl graceful') }}
- python_shell: True
{% endif %}
apache-restart:
2014-09-25 18:48:36 +02:00
module.wait:
{% if apache.service_state in ['running'] %}
- name: service.restart
2014-03-04 20:13:26 +01:00
- m_name: {{ apache.service }}
{% else %}
- name: cmd.run
- cmd: {{ apache.custom_reload_command|default('apachectl graceful') }}
- python_shell: True
{% endif %}
{% else %}
apache-reload:
test.show_notification:
- name: Skipping reload per user request
- text: Pillar manage_service_states is False
apache-restart:
test.show_notification:
- name: Skipping restart per user request
- text: Pillar manage_service_states is False
{% endif %}