2013-09-03 21:28:00 +02:00
|
|
|
{% 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 }}
|
2017-03-29 12:32:18 +02:00
|
|
|
group.present:
|
|
|
|
- name: {{ apache.group }}
|
|
|
|
- system: True
|
|
|
|
user.present:
|
|
|
|
- name: {{ apache.user }}
|
|
|
|
- gid: {{ apache.group }}
|
|
|
|
- system: True
|
2017-11-03 17:59:12 +01:00
|
|
|
{# By default run apache service states (unless pillar is false) #}
|
|
|
|
{% if salt['pillar.get']('apache:manage_service_states', True) %}
|
2019-10-17 08:47:49 +02:00
|
|
|
service.{{ apache.service_state }}:
|
2013-08-23 05:14:28 +02:00
|
|
|
- name: {{ apache.service }}
|
2018-11-09 00:25:52 +01:00
|
|
|
{% if apache.service_state in [ 'running', 'dead' ] %}
|
2013-08-13 23:03:16 +02:00
|
|
|
- enable: True
|
2018-11-09 00:25:52 +01:00
|
|
|
{% endif %}
|
2013-11-05 20:34:06 +01:00
|
|
|
|
2014-08-06 23:06:05 +02:00
|
|
|
# The following states are inert by default and can be used by other states to
|
|
|
|
# trigger a restart or reload as needed.
|
2013-11-05 20:34:06 +01:00
|
|
|
apache-reload:
|
2014-09-25 18:48:36 +02:00
|
|
|
module.wait:
|
2018-11-09 00:25:52 +01:00
|
|
|
{% if apache.service_state in ['running'] %}
|
2014-01-04 12:59:39 +01:00
|
|
|
- name: service.reload
|
|
|
|
- m_name: {{ apache.service }}
|
2018-11-09 00:25:52 +01:00
|
|
|
{% else %}
|
|
|
|
- name: cmd.run
|
2019-10-17 08:47:49 +02:00
|
|
|
- cmd: {{ apache.custom_reload_command|default('apachectl graceful') }}
|
2018-11-09 00:25:52 +01:00
|
|
|
- python_shell: True
|
|
|
|
{% endif %}
|
2013-11-05 20:34:06 +01:00
|
|
|
|
|
|
|
apache-restart:
|
2014-09-25 18:48:36 +02:00
|
|
|
module.wait:
|
2018-11-09 00:25:52 +01:00
|
|
|
{% if apache.service_state in ['running'] %}
|
2014-01-04 12:59:39 +01:00
|
|
|
- name: service.restart
|
2014-03-04 20:13:26 +01:00
|
|
|
- m_name: {{ apache.service }}
|
2018-11-09 00:25:52 +01:00
|
|
|
{% else %}
|
|
|
|
- name: cmd.run
|
2019-10-17 08:47:49 +02:00
|
|
|
- cmd: {{ apache.custom_reload_command|default('apachectl graceful') }}
|
2018-11-09 00:25:52 +01:00
|
|
|
- python_shell: True
|
|
|
|
{% endif %}
|
2017-11-03 17:59:12 +01:00
|
|
|
|
|
|
|
{% 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 %}
|