refactor(minion): use `pkg.installed` state for macOS

Keep consistent with `salt/master.sls`.
This commit is contained in:
Imran Iqbal 2022-05-16 12:44:47 +01:00
parent 8ab60b9689
commit 3eff2d2acf
No known key found for this signature in database
GPG Key ID: 6D8629439D2B7819
1 changed files with 9 additions and 6 deletions

View File

@ -29,10 +29,13 @@ download-salt-minion:
- macpackage: salt-minion - macpackage: salt-minion
- retry: {{ salt_settings.retry_options | json }} - retry: {{ salt_settings.retry_options | json }}
{%- elif "workaround https://github.com/saltstack/salt/issues/49348" %} {%- elif "workaround https://github.com/saltstack/salt/issues/49348" %}
cmd.run: {% if salt_settings.install_packages %}
- name: /usr/local/bin/brew install {{ salt_settings.salt_minion }} pkg.installed:
- onlyif: test -x /usr/local/bin/brew - name: {{ salt_settings.salt_minion }}
- runas: {{ salt_settings.rootuser }} {%- if salt_settings.version is defined %}
- version: {{ salt_settings.version }}
{%- endif %}
{% endif %}
{%- endif %} {%- endif %}
salt-minion-macos: salt-minion-macos:
@ -130,7 +133,7 @@ salt-minion:
{%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source %} {%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source %}
- macpackage: salt-minion - macpackage: salt-minion
{%- elif grains.os == 'MacOS' %} {%- elif grains.os == 'MacOS' %}
- cmd: download-salt-minion - pkg: download-salt-minion
{%- else %} {%- else %}
- pkg: salt-minion - pkg: salt-minion
{%- endif %} {%- endif %}
@ -155,7 +158,7 @@ restart-salt-minion:
{%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source %} {%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source %}
- macpackage: salt-minion - macpackage: salt-minion
{%- elif grains.os == 'MacOS' %} {%- elif grains.os == 'MacOS' %}
- cmd: download-salt-minion - pkg: download-salt-minion
{%- else %} {%- else %}
- pkg: salt-minion - pkg: salt-minion
{%- endif %} {%- endif %}