Selaa lähdekoodia

Merge "Adding environment variables for salt minion"

pull/73/head
mcp-jenkins 6 vuotta sitten
vanhempi
commit
46774e8b9a
8 muutettua tiedostoa jossa 70 lisäystä ja 0 poistoa
  1. +1
    -0
      .kitchen.yml
  2. +9
    -0
      README.rst
  3. +7
    -0
      salt/files/etc_default_salt-minion
  4. +2
    -0
      salt/files/systemd_minion_override.conf
  5. +11
    -0
      salt/map.jinja
  6. +32
    -0
      salt/minion/env_vars.sls
  7. +3
    -0
      salt/minion/init.sls
  8. +5
    -0
      tests/pillar/minion_env_vars.sls

+ 1
- 0
.kitchen.yml Näytä tiedosto

@@ -86,6 +86,7 @@ suites:
minion_local_pillar.sls: tests/pillar/minion_local_pillar.sls
minion_local_reclass.sls: tests/pillar/minion_local_reclass.sls
minion_backend_urllib.sls: tests/pillar/minion_backend_urllib.sls
minion_env_vars.sls: tests/pillar/minion_env_vars.sls

- name: master-default
provisioner:

+ 9
- 0
README.rst Näytä tiedosto

@@ -565,6 +565,15 @@ useful for cases where you need to set no_proxy lists.
minion:
backend: urllib2

Salt minion using environment variables defined in /etc/default/salt-minion for
upstart based Ubuntu and in /etc/environment for Ubuntu with systemd.

.. code-block:: yaml

salt:
minion:
env_vars:
engine: file

Salt minion with PKI certificate authority (CA)


+ 7
- 0
salt/files/etc_default_salt-minion Näytä tiedosto

@@ -0,0 +1,7 @@
{%- from "salt/map.jinja" import minion with context -%}
{%- if minion.env_vars.variables is defined -%}
{%- for envvar_name, envvar_value in minion.env_vars.get('variables', {}).iteritems() %}
export {{ envvar_name }}={% if envvar_value is string -%}{{ envvar_value }}{%- else -%}{{ envvar_value|join(',') }}
{%- endif %}
{%- endfor %}
{%- endif %}

+ 2
- 0
salt/files/systemd_minion_override.conf Näytä tiedosto

@@ -0,0 +1,2 @@
[Service]
EnvironmentFile=/etc/environment

+ 11
- 0
salt/map.jinja Näytä tiedosto

@@ -148,6 +148,17 @@ RedHat:
}, merge=pillar.salt.minion.get('proxy_minion', {})) %}
{%- endif %}

{%- if pillar.salt.minion.env_vars is defined %}
{% set env_vars = salt['grains.filter_by']({
'Debian': {
'engine': 'file'
},
'RedHat': {
'engine': 'file'
},
}, merge=pillar.salt.minion.get('env_vars', {})) %}
{%- endif %}

{%- endif %}



+ 32
- 0
salt/minion/env_vars.sls Näytä tiedosto

@@ -0,0 +1,32 @@
{%- from "salt/map.jinja" import minion,env_vars with context %}

{%- if env_vars.engine is defined %}
{%- if env_vars.engine == 'file' %}

/etc/default/salt-minion:
file.managed:
- source: salt://salt/files/etc_default_salt-minion
- user: root
- group: root
- template: jinja
- require:
- {{ minion.install_state }}
- onchanges_in:
- cmd: salt_minion_service_restart

{%- if grains.get('init', None) == 'systemd' %}
/etc/systemd/system/salt-minion.service.d/override.conf:
file.managed:
- source: salt://salt/files/systemd_minion_override.conf
- user: root
- makedirs: True
- group: root
- template: jinja
- require:
- {{ minion.install_state }}
- onchanges_in:
- cmd: salt_minion_service_restart

{%- endif %}
{%- endif %}
{%- endif %}

+ 3
- 0
salt/minion/init.sls Näytä tiedosto

@@ -11,3 +11,6 @@ include:
{%- if pillar.salt.minion.proxy_minion is defined %}
- salt.minion.proxy
{%- endif %}
{%- if pillar.salt.minion.env_vars is defined %}
- salt.minion.env_vars
{%- endif %}

+ 5
- 0
tests/pillar/minion_env_vars.sls Näytä tiedosto

@@ -0,0 +1,5 @@
salt:
minion:
enabled: true
env_vars:
engine: file

Loading…
Peruuta
Tallenna