|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- {%- from "salt/map.jinja" import master, renderer with context %}
- {%- if master.enabled %}
-
- {%- if master.source.get('engine', 'pkg') == 'pkg' %}
-
- salt_master_packages:
- pkg.installed:
- - names: {{ master.pkgs }}
- {%- if master.source.version is defined %}
- - version: {{ master.source.version }}
- {%- endif %}
-
- {%- elif master.source.get('engine', 'pkg') == 'pip' %}
-
- salt_master_packages:
- pip.installed:
- - name: salt{% if master.source.version is defined %}=={{ master.source.version }}{% endif %}
-
- {%- endif %}
-
- /etc/salt/master.d/master.conf:
- file.managed:
- - source: salt://salt/files/master.conf
- - user: root
- - template: jinja
- - require:
- - {{ master.install_state }}
- - watch_in:
- - service: salt_master_service
-
- {%- if master.cache is defined %}
-
- /etc/salt/master.d/_{{ master.cache.plugin }}.conf:
- file.managed:
- - source: salt://salt/files/cache/_{{ master.cache.plugin }}.conf
- - user: root
- - template: jinja
- - require:
- - {{ master.install_state }}
- - watch_in:
- - service: salt_master_service
-
- {%- endif %}
-
- {%- if master.user is defined %}
-
- /etc/salt/master.d/_acl.conf:
- file.managed:
- - source: salt://salt/files/_acl.conf
- - user: root
- - template: jinja
- - require:
- - {{ master.install_state }}
- - watch_in:
- - service: salt_master_service
-
- {%- endif %}
-
- {%- if master.engine is defined %}
-
- /etc/salt/master.d/_engine.conf:
- file.managed:
- - source: salt://salt/files/_engine.conf
- - user: root
- - template: jinja
- - require:
- - {{ master.install_state }}
- - watch_in:
- - service: salt_master_service
-
- {%- endif %}
-
- {%- if master.peer is defined %}
-
- /etc/salt/master.d/_peer.conf:
- file.managed:
- - source: salt://salt/files/_peer.conf
- - user: root
- - template: jinja
- - require:
- - {{ master.install_state }}
- - watch_in:
- - service: salt_master_service
-
- {%- endif %}
-
- {%- if renderer | length > 0 %}
-
- /etc/salt/master.d/_renderer.conf:
- file.managed:
- - source: salt://salt/files/_renderer.conf
- - user: root
- - template: jinja
- - require:
- - {{ master.install_state }}
- - watch_in:
- - service: salt_master_service
-
- {%- endif %}
-
- salt_master_service:
- service.running:
- - name: {{ master.service }}
- - enable: True
- {%- if grains['saltversioninfo'][0] >= 2017 and grains['saltversioninfo'][1] >= 7 %}
- - retry:
- attempts: 2
- interval: 5
- splay: 5
- {%- endif %}
-
- /srv/salt/env:
- file.directory:
- - user: root
- - mode: 755
- - makedirs: true
-
- {%- endif %}
|