Przeglądaj źródła

Merge pull request #453 from cr1st1p/allow-disable-services

Allow disabling services or just ignoring them.
tags/v1.3.0
Imran Iqbal 4 lat temu
rodzic
commit
10e8778647
Brak konta powiązanego z adresem e-mail autora
4 zmienionych plików z 33 dodań i 7 usunięć
  1. +4
    -2
      salt/api.sls
  2. +15
    -0
      salt/defaults.yaml
  3. +6
    -3
      salt/master.sls
  4. +8
    -2
      salt/minion.sls

+ 4
- 2
salt/api.sls Wyświetl plik

@@ -11,8 +11,9 @@ salt-api:
- version: {{ salt_settings.version }}
{%- endif %}
{% endif %}
service.running:
- enable: True
{% if salt_settings.api_service_details.state != 'ignore' %}
service.{{ salt_settings.api_service_details.state }}:
- enable: {{ salt_settings.api_service_details.enabled }}:
- name: {{ salt_settings.api_service }}
- require:
- service: {{ salt_settings.master_service }}
@@ -21,3 +22,4 @@ salt-api:
- pkg: salt-api
{% endif %}
- file: salt-master
{% endif %}

+ 15
- 0
salt/defaults.yaml Wyświetl plik

@@ -19,8 +19,23 @@ salt:
master_config_use_TOFS: false

minion_service: salt-minion
minion_service_details:
# special name 'ignore' will not output anything about the service
state: running
enabled: true

master_service: salt-master
master_service_details:
# special name 'ignore' will not output anything about the service
state: running
enabled: true

api_service: salt-api
api_service_details:
# special name 'ignore' will not output anything about the service
state: running
enabled: true

syndic_service: salt-syndic

salt_master: salt-master

+ 6
- 3
salt/master.sls Wyświetl plik

@@ -9,10 +9,12 @@ salt-master:
{%- if salt_settings.version is defined %}
- version: {{ salt_settings.version }}
{%- endif %}
{% if salt_settings.master_service_details.state != 'ignore' %}
- require_in:
- service: salt-master
- watch_in:
- service: salt-master
{% endif %}
{% endif %}
file.recurse:
- name: {{ salt_settings.config_path }}/master.d
@@ -28,13 +30,14 @@ salt-master:
{%- endif %}
- clean: {{ salt_settings.clean_config_d_dir }}
- exclude_pat: _*
service.running:
- enable: True
{% if salt_settings.master_service_details.state != 'ignore' %}
service.{{ salt_settings.master_service_details.state }}:
- enable: {{ salt_settings.master_service_details.enabled }}
- name: {{ salt_settings.master_service }}
- watch:
- file: salt-master
- file: remove-old-master-conf-file
{% endif %}
{% if salt_settings.master_remove_config %}
remove-default-master-conf-file:
file.absent:

+ 8
- 2
salt/minion.sls Wyświetl plik

@@ -41,8 +41,10 @@ salt-minion:
- force: True
- unless:
- test -n "{{ salt_settings.version }}" && '/opt/salt/bin/salt-minion --version=.*{{ salt_settings.version }}.*'
{% if salt_settings.minion_service_details.state != 'ignore' %}
- require_in:
- service: salt-minion
{% endif %}
- onchanges_in:
- cmd: remove-macpackage-salt
{%- elif grains.os != 'MacOS' and "workaround https://github.com/saltstack/salt/issues/49348" %}
@@ -51,8 +53,10 @@ salt-minion:
{%- if salt_settings.version %}
- version: {{ salt_settings.version }}
{%- endif %}
{% if salt_settings.minion_service_details.state != 'ignore' %}
- require_in:
- service: salt-minion
{% endif %}
{%- endif %}
{% endif %}
file.recurse:
@@ -71,11 +75,13 @@ salt-minion:
{%- endif %}
- clean: {{ salt_settings.clean_config_d_dir }}
- exclude_pat: _*
service.running:
- enable: True
{% if salt_settings.minion_service_details.state != 'ignore' %}
service.{{ salt_settings.minion_service_details.state }}:
- enable: {{ salt_settings.minion_service_details.enabled }}
- name: {{ salt_settings.minion_service }}
- require:
- file: salt-minion
{% endif %}
{%- if not salt_settings.restart_via_at %}
cmd.run:
{%- if grains['saltversioninfo'] >= [ 2016, 3 ] %}

Ładowanie…
Anuluj
Zapisz