瀏覽代碼

Fix minion install pkgs and dependency packages

pr/fix/minion_dependencis
Petr Michalec 7 年之前
父節點
當前提交
2162e5dfc6
沒有連結到貢獻者的電子郵件帳戶。
共有 3 個檔案被更改,包括 25 行新增7 行删除
  1. +10
    -2
      salt/map.jinja
  2. +1
    -5
      salt/minion/grains.sls
  3. +14
    -0
      salt/minion/service.sls

+ 10
- 2
salt/map.jinja 查看文件

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 %}

+ 1
- 5
salt/minion/grains.sls 查看文件

- 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:

+ 14
- 0
salt/minion/service.sls 查看文件

- 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 %}

Loading…
取消
儲存