apache-formula/apache/init.sls
alxwr 4af4ff5970 Restart (if needed) before reload (#244)
Some configuration changes only take effect after a restart of the service.
When the module 'apache-reload' is triggered too early, it fails which results
in a false-negative result of the Salt run.
In order to fix that 'apache-restart' and the service definition itself are
put before 'apache-reload'. Reload should always succeed if restart did.
2018-11-07 20:06:30 +01:00

49 lines
1.2 KiB
Plaintext

{% from "apache/map.jinja" import apache with context %}
apache:
pkg.installed:
- 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.running:
- name: {{ apache.service }}
- enable: True
- require:
- module: apache-restart
- module: apache-reload
# The following states are inert by default and can be used by other states to
# trigger a restart or reload as needed.
apache-reload:
module.wait:
- name: service.reload
- m_name: {{ apache.service }}
- require:
- module: apache-restart
apache-restart:
module.wait:
- name: service.restart
- m_name: {{ apache.service }}
{% 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 %}