Browse Source

separate state for minion restart dropin

master
Sean Johnson 2 years ago
parent
commit
236cab0e55
  1. 41
      salt/minion.sls

41
salt/minion.sls

@ -57,6 +57,28 @@ salt-minion-macos:
{%- endif %}
{%- endif %}
/lib/systemd/system/salt-minion.service.d/10-restart.conf:
{% if salt_settings.minion_service_details.restart_on_fail %}
file.managed:
- makedirs: true
{% else %}
file.absent:
{% endif %}
- name: /lib/systemd/system/salt-minion.service.d/10-restart.conf
- contents: |
[Unit]
StartLimitIntervalSec=120
StartLimitBurst=10
[Service]
Restart=on-failure
RestartSec=5s
{%- if "systemd" in grains and salt_settings.minion_service_details.restart_on_fail %}
cmd.run:
- name: 'systemctl daemon-reload'
- watch:
- file: /lib/systemd/system/salt-minion.service.d/10-restart.conf
{%- endif %}
salt-minion:
{% if salt_settings.install_packages %}
{%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source %}
@ -101,19 +123,6 @@ salt-minion:
{%- endif %}
- clean: {{ salt_settings.clean_config_d_dir }}
- exclude_pat: _*
{% if salt_settings.minion_service_details.restart_on_fail %}
file.managed:
{% else %}
file.absent:
{% endif %}
- name: /lib/systemd/system/salt-minion.service.d/10-restart.conf
- contents: |
[Unit]
StartLimitIntervalSec=120
StartLimitBurst=10
[Service]
Restart=on-failure
RestartSec=5s
{% if salt_settings.minion_service_details.state != 'ignore' %}
service.{{ salt_settings.minion_service_details.state }}:
- enable: {{ salt_settings.minion_service_details.enabled }}
@ -129,11 +138,7 @@ salt-minion:
{%- if grains['kernel'] == 'Windows' %}
- name: 'salt-call.bat --local service.restart {{ salt_settings.minion_service }}'
{%- else %}
- name: |-
{%- if "systemd" in grains and salt_settings.minion_service_details.restart_on_fail %}
systemctl daemon-reload
{%- endif %}
salt-call --local service.restart {{ salt_settings.minion_service }} --out-file /dev/null
- name: 'salt-call --local service.restart {{ salt_settings.minion_service }} --out-file /dev/null'
{%- endif %}
- bg: True
{%- else %}

Loading…
Cancel
Save