Sfoglia il codice sorgente

Fix minion install pkgs and dependency packages

pr/fix/minion_dependencis
Petr Michalec 7 anni fa
parent
commit
2162e5dfc6
Nessun account collegato all'indirizzo email del committer
3 ha cambiato i file con 25 aggiunte e 7 eliminazioni
  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 Vedi File

@@ -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 Vedi File

@@ -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 Vedi File

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

Loading…
Annulla
Salva