Ver código fonte

Fix minion install pkgs and dependency packages

pr/fix/minion_dependencis
Petr Michalec 7 anos atrás
pai
commit
2162e5dfc6
Nenhuma conta vinculada ao e-mail do autor do commit
3 arquivos alterados com 25 adições e 7 exclusões
  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 Ver arquivo

@@ -94,10 +94,14 @@ Arch:
Debian:
pkgs:
- salt-minion
dependency_pkgs:
- python-m2crypto
- python-psutil
grains_validity_pkgs:
- python-yaml
dependency_pkgs_pip:
- PyYAML
- M2Crypto
- psutil
Gentoo:
pkgs:
- app-admin/salt
@@ -107,10 +111,14 @@ MacOS:
RedHat:
pkgs:
- salt-minion
dependency_pkgs:
- m2crypto
- psutils
grains_validity_pkgs:
- PyYAML
dependency_pkgs_pip:
- PyYAML
- M2Crypto
- psutil
{%- endload %}

{%- if pillar.salt.minion is defined %}

+ 1
- 5
salt/minion/grains.sls Ver arquivo

@@ -22,10 +22,6 @@ salt_minion_grains_files:
- require:
- 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() %}
{%- set support_fragment_file = service_name+'/meta/salt.yml' %}
{%- macro load_support_file() %}{% include support_fragment_file ignore missing %}{% endmacro %}
@@ -45,7 +41,7 @@ salt_minion_grain_{{ service_name }}_{{ name }}_validity_check:
cmd.wait:
- name: python -c "import yaml; stream = file('/etc/salt/grains.d/{{ name }}', 'r'); yaml.load(stream); stream.close()"
- require:
- pkg: salt_minion_grains_pkg_validity_check
- pkg: salt_minion_dependency_packages
- watch:
- file: salt_minion_grain_{{ service_name }}_{{ name }}
- watch_in:

+ 14
- 0
salt/minion/service.sls Ver arquivo

@@ -10,12 +10,20 @@ salt_minion_packages:
- version: {{ minion.source.version }}
{%- endif %}

salt_minion_dependency_packages:
pkg.installed:
- pkgs: {{ minion.dependency_pkgs }}

{%- elif minion.source.get('engine', 'pkg') == 'pip' %}

salt_minion_packages:
pip.installed:
- name: salt{% if minion.source.version is defined %}=={{ minion.source.version }}{% endif %}

salt_minion_dependency_packages:
pkg.installed:
- pkgs: {{ minion.dependency_pkgs_pip }}

{%- endif %}

/etc/salt/minion.d/minion.conf:
@@ -36,6 +44,9 @@ salt_minion_service:
service.running:
- name: {{ minion.service }}
- enable: true
- require:
- pkg: salt_minion_packages
- pkg: salt_minion_dependency_packages
{%- endif %}

salt_minion_sync_all:
@@ -45,5 +56,8 @@ salt_minion_sync_all:
- watch:
- service: salt_minion_service
{%- endif %}
- require:
- pkg: salt_minion_packages
- pkg: salt_minion_dependency_packages

{%- endif %}

Carregando…
Cancelar
Salvar