salt/states/salt/minion/init.sls
Joe Groocock c53abe2b6a
Manage salt-minion package, service and config
Restart the service after upgrading the package or modifying the minion
configuration file.

Signed-off-by: Joe Groocock <me@frebib.net>
2020-07-12 16:20:23 +01:00

37 lines
696 B
Plaintext

{%- set masters = ['salt.nerdhouse.io'] %}
salt-minion:
pkg.installed:
- version: latest
service.running:
- enable: true
- require:
- pkg: salt-minion
- file: /etc/salt/minion
service.restart:
- order: last
- no_block: true
- watch:
- pkg: salt-minion
- file: /etc/salt/minion
- require:
- cmd: check-minion-config
/etc/salt/minion:
file.managed:
- source: salt://{{ slspath }}/minion.jinja
- user: root
- group: root
- mode: 644
- context:
- masters: {{ masters|json }}
- require:
- pkg: salt-minion
check-minion-config:
cmd.run:
- name: sudo salt-call --local --skip-grains test.ping
- watch:
- file: /etc/salt/minion