Browse Source

Merge "Restart salt-minion on config change"

pr/fix/install_formulas_fix
Jakub Josef 7 years ago
parent
commit
c37c16de31
1 changed files with 15 additions and 2 deletions
  1. +15
    -2
      salt/minion/service.sls

+ 15
- 2
salt/minion/service.sls View File

- name: /etc/salt/minion.d/_{{ name }}.conf - name: /etc/salt/minion.d/_{{ name }}.conf
- contents: | - contents: |
{{ conf|yaml(False)|indent(8) }} {{ conf|yaml(False)|indent(8) }}
{%- if not grains.get('noservices', False) %}
- watch_in:
- cmd: salt_minion_service_restart
{%- endif %}
- require: - require:
- {{ minion.install_state }} - {{ minion.install_state }}


- watch: - watch:
- file: salt_minion_config_{{ service_name }}_{{ name }} - file: salt_minion_config_{{ service_name }}_{{ name }}
{%- if not grains.get('noservices', False) %} {%- if not grains.get('noservices', False) %}
- watch_in:
- service: salt_minion_service
- require_in:
- cmd: salt_minion_service_restart
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}
service.running: service.running:
- name: {{ minion.service }} - name: {{ minion.service }}
- enable: true - enable: true

{#- Restart salt-minion if needed but after all states are executed #}
salt_minion_service_restart:
cmd.wait:
- name: 'while true; do salt-call saltutil.running|grep fun: && continue; salt-call --local service.restart {{ minion.service }}; done'
- shell: /bin/bash
- bg: true
- require:
- service: salt_minion_service
{%- endif %} {%- endif %}


salt_minion_sync_all: salt_minion_sync_all:

Loading…
Cancel
Save