Debian: | Debian: | ||||
pkgs: | pkgs: | ||||
- salt-minion | - salt-minion | ||||
dependency_pkgs: | |||||
- python-m2crypto | - python-m2crypto | ||||
- python-psutil | - python-psutil | ||||
grains_validity_pkgs: | |||||
- python-yaml | - python-yaml | ||||
dependency_pkgs_pip: | |||||
- PyYAML | |||||
- M2Crypto | |||||
- psutil | |||||
Gentoo: | Gentoo: | ||||
pkgs: | pkgs: | ||||
- app-admin/salt | - app-admin/salt | ||||
RedHat: | RedHat: | ||||
pkgs: | pkgs: | ||||
- salt-minion | - salt-minion | ||||
dependency_pkgs: | |||||
- m2crypto | - m2crypto | ||||
- psutils | - psutils | ||||
grains_validity_pkgs: | |||||
- PyYAML | - PyYAML | ||||
dependency_pkgs_pip: | |||||
- PyYAML | |||||
- M2Crypto | |||||
- psutil | |||||
{%- endload %} | {%- endload %} | ||||
{%- if pillar.salt.minion is defined %} | {%- if pillar.salt.minion is defined %} |
- require: | - require: | ||||
- file: salt_minion_grains_dir | - file: salt_minion_grains_dir | ||||
salt_minion_grains_pkg_validity_check: | |||||
pkg.installed: | |||||
- pkgs: {{ minion.grains_validity_pkgs }} | |||||
{%- for service_name, service in pillar.items() %} | {%- for service_name, service in pillar.items() %} | ||||
{%- set support_fragment_file = service_name+'/meta/salt.yml' %} | {%- set support_fragment_file = service_name+'/meta/salt.yml' %} | ||||
{%- macro load_support_file() %}{% include support_fragment_file ignore missing %}{% endmacro %} | {%- macro load_support_file() %}{% include support_fragment_file ignore missing %}{% endmacro %} | ||||
cmd.wait: | cmd.wait: | ||||
- name: python -c "import yaml; stream = file('/etc/salt/grains.d/{{ name }}', 'r'); yaml.load(stream); stream.close()" | - name: python -c "import yaml; stream = file('/etc/salt/grains.d/{{ name }}', 'r'); yaml.load(stream); stream.close()" | ||||
- require: | - require: | ||||
- pkg: salt_minion_grains_pkg_validity_check | |||||
- pkg: salt_minion_dependency_packages | |||||
- watch: | - watch: | ||||
- file: salt_minion_grain_{{ service_name }}_{{ name }} | - file: salt_minion_grain_{{ service_name }}_{{ name }} | ||||
- watch_in: | - watch_in: |
- version: {{ minion.source.version }} | - version: {{ minion.source.version }} | ||||
{%- endif %} | {%- endif %} | ||||
salt_minion_dependency_packages: | |||||
pkg.installed: | |||||
- pkgs: {{ minion.dependency_pkgs }} | |||||
{%- elif minion.source.get('engine', 'pkg') == 'pip' %} | {%- elif minion.source.get('engine', 'pkg') == 'pip' %} | ||||
salt_minion_packages: | salt_minion_packages: | ||||
pip.installed: | pip.installed: | ||||
- name: salt{% if minion.source.version is defined %}=={{ minion.source.version }}{% endif %} | - name: salt{% if minion.source.version is defined %}=={{ minion.source.version }}{% endif %} | ||||
salt_minion_dependency_packages: | |||||
pkg.installed: | |||||
- pkgs: {{ minion.dependency_pkgs_pip }} | |||||
{%- endif %} | {%- endif %} | ||||
/etc/salt/minion.d/minion.conf: | /etc/salt/minion.d/minion.conf: | ||||
service.running: | service.running: | ||||
- name: {{ minion.service }} | - name: {{ minion.service }} | ||||
- enable: true | - enable: true | ||||
- require: | |||||
- pkg: salt_minion_packages | |||||
- pkg: salt_minion_dependency_packages | |||||
{%- endif %} | {%- endif %} | ||||
salt_minion_sync_all: | salt_minion_sync_all: | ||||
- watch: | - watch: | ||||
- service: salt_minion_service | - service: salt_minion_service | ||||
{%- endif %} | {%- endif %} | ||||
- require: | |||||
- pkg: salt_minion_packages | |||||
- pkg: salt_minion_dependency_packages | |||||
{%- endif %} | {%- endif %} |