Instead of the default service.running + enabled, you can control the actual state, via pillar. And you can even say 'state = ignore' and no state will be generated to control the servicetags/v1.3.0
- version: {{ salt_settings.version }} | - version: {{ salt_settings.version }} | ||||
{%- endif %} | {%- endif %} | ||||
{% 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 }} | - name: {{ salt_settings.api_service }} | ||||
- require: | - require: | ||||
- service: {{ salt_settings.master_service }} | - service: {{ salt_settings.master_service }} | ||||
- pkg: salt-api | - pkg: salt-api | ||||
{% endif %} | {% endif %} | ||||
- file: salt-master | - file: salt-master | ||||
{% endif %} |
master_config_use_TOFS: false | master_config_use_TOFS: false | ||||
minion_service: salt-minion | 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: 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: salt-api | ||||
api_service_details: | |||||
# special name 'ignore' will not output anything about the service | |||||
state: running | |||||
enabled: true | |||||
syndic_service: salt-syndic | syndic_service: salt-syndic | ||||
salt_master: salt-master | salt_master: salt-master |
{%- if salt_settings.version is defined %} | {%- if salt_settings.version is defined %} | ||||
- version: {{ salt_settings.version }} | - version: {{ salt_settings.version }} | ||||
{%- endif %} | {%- endif %} | ||||
{% if salt_settings.master_service_details.state != 'ignore' %} | |||||
- require_in: | - require_in: | ||||
- service: salt-master | - service: salt-master | ||||
- watch_in: | - watch_in: | ||||
- service: salt-master | - service: salt-master | ||||
{% endif %} | |||||
{% endif %} | {% endif %} | ||||
file.recurse: | file.recurse: | ||||
- name: {{ salt_settings.config_path }}/master.d | - name: {{ salt_settings.config_path }}/master.d | ||||
{%- endif %} | {%- endif %} | ||||
- clean: {{ salt_settings.clean_config_d_dir }} | - clean: {{ salt_settings.clean_config_d_dir }} | ||||
- exclude_pat: _* | - 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 }} | - name: {{ salt_settings.master_service }} | ||||
- watch: | - watch: | ||||
- file: salt-master | - file: salt-master | ||||
- file: remove-old-master-conf-file | - file: remove-old-master-conf-file | ||||
{% endif %} | |||||
{% if salt_settings.master_remove_config %} | {% if salt_settings.master_remove_config %} | ||||
remove-default-master-conf-file: | remove-default-master-conf-file: | ||||
file.absent: | file.absent: |
- force: True | - force: True | ||||
- unless: | - unless: | ||||
- test -n "{{ salt_settings.version }}" && '/opt/salt/bin/salt-minion --version=.*{{ salt_settings.version }}.*' | - test -n "{{ salt_settings.version }}" && '/opt/salt/bin/salt-minion --version=.*{{ salt_settings.version }}.*' | ||||
{% if salt_settings.minion_service_details.state != 'ignore' %} | |||||
- require_in: | - require_in: | ||||
- service: salt-minion | - service: salt-minion | ||||
{% endif %} | |||||
- onchanges_in: | - onchanges_in: | ||||
- cmd: remove-macpackage-salt | - cmd: remove-macpackage-salt | ||||
{%- elif grains.os != 'MacOS' and "workaround https://github.com/saltstack/salt/issues/49348" %} | {%- elif grains.os != 'MacOS' and "workaround https://github.com/saltstack/salt/issues/49348" %} | ||||
{%- if salt_settings.version %} | {%- if salt_settings.version %} | ||||
- version: {{ salt_settings.version }} | - version: {{ salt_settings.version }} | ||||
{%- endif %} | {%- endif %} | ||||
{% if salt_settings.minion_service_details.state != 'ignore' %} | |||||
- require_in: | - require_in: | ||||
- service: salt-minion | - service: salt-minion | ||||
{% endif %} | |||||
{%- endif %} | {%- endif %} | ||||
{% endif %} | {% endif %} | ||||
file.recurse: | file.recurse: | ||||
{%- endif %} | {%- endif %} | ||||
- clean: {{ salt_settings.clean_config_d_dir }} | - clean: {{ salt_settings.clean_config_d_dir }} | ||||
- exclude_pat: _* | - 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 }} | - name: {{ salt_settings.minion_service }} | ||||
- require: | - require: | ||||
- file: salt-minion | - file: salt-minion | ||||
{% endif %} | |||||
{%- if not salt_settings.restart_via_at %} | {%- if not salt_settings.restart_via_at %} | ||||
cmd.run: | cmd.run: | ||||
{%- if grains['saltversioninfo'] >= [ 2016, 3 ] %} | {%- if grains['saltversioninfo'] >= [ 2016, 3 ] %} |