Browse Source

Extending salt minion and slat master params.

Change-Id: Ia9410364a82ac84889b80b30380ec5f897c7165c
pull/73/head
Dzmitry Stremkouski 6 years ago
parent
commit
7b15d8a383
4 changed files with 66 additions and 19 deletions
  1. +16
    -2
      README.rst
  2. +16
    -2
      salt/files/master.conf
  3. +27
    -15
      salt/files/minion.conf
  4. +7
    -0
      tests/pillar/master_api.sls

+ 16
- 2
README.rst View File

@@ -43,8 +43,22 @@ Salt master with Architect ENC metadata back end:

Salt master with multiple ``ext_pillars``:

.. literalinclude:: tests/pillar/master_single_extpillars.sls
:language: yaml
.. code-block:: yaml

salt:
master:
enabled: true
pillar:
engine: salt
source:
engine: local
ext_pillars:
1:
module: cmd_json
params: '"echo {\"arg\": \"val\"}"'
2:
module: cmd_yaml
params: /usr/local/bin/get_yml.sh

Salt master with API:


+ 16
- 2
salt/files/master.conf View File

@@ -4,9 +4,18 @@
worker_threads: {{ master.worker_threads }}
timeout: {{ master.command_timeout }}

{%- if master.get('max_open_files') %}
{%- if master.interface is defined %}
interface: {{ master.interface }}
{%- endif %}
{%- if master.max_open_files is defined %}
max_open_files: {{ master.max_open_files }}
{%- endif %}
{%- if master.pki_dir is defined %}
pki_dir: {{ master.pki_dir }}
{%- endif %}
{%- if master.cachedir is defined %}
cachedir: {{ master.cachedir }}
{%- endif %}

state_output: {{ master.get('state_output', 'changes') }}

@@ -50,7 +59,7 @@ open_mode: True
auto_accept: True
{%- endif %}

{%- if master.get('max_event_size') %}
{%- if master.max_event_size is defined %}
max_event_size: {{ master.max_event_size }}
{%- endif %}

@@ -136,6 +145,11 @@ ext_pillar:
{%- endfor %}
{%- endif %}
{%- endif %}
{%- if master.ext_pillars is defined %}
{%- for _, ext_pillar in master.ext_pillars.items() %}
- {{ ext_pillar.module }}: {{ ext_pillar.params }}
{%- endfor %}
{%- endif %}

{%- if master.pillar.engine == 'reclass'
or (master.pillar.engine == 'composite' and

+ 27
- 15
salt/files/minion.conf View File

@@ -1,35 +1,47 @@
{%- from "salt/map.jinja" import minion with context %}
{%- from "linux/map.jinja" import system with context %}

{%- if minion.masters is defined %}

{%- from "salt/map.jinja" import minion with context -%}
{%- from "linux/map.jinja" import system with context -%}
{%- if minion.masters is defined -%}
master:
{%- for master in minion.masters %}
- {{ master.host }}
{%- endfor %}

{%- if minion.get('master_type', 'default') == "failover" %}
master_type: failover
retry_dns: 0
master_shuffle: True
master_alive_interval: 60
{%- endif %}

{%- else %}

master: {{ minion.master.host }}

{%- endif %}

id: {{ minion.id | default(system.name~"."~system.domain) }}

{%- for opt in ['max_event_size', 'acceptance_wait_time_max',
'acceptance_wait_time', 'random_reauth_delay', 'recon_default', 'recon_max',
'recon_randomize', 'auth_timeout'] %}
{% if minion.get(opt) %}
{%- set opt_list=[
'acceptance_wait_time',
'acceptance_wait_time_max',
'auth_timeout',
'cachedir',
'grains_refresh_every',
'master_alive_interval',
'master_tries',
'max_event_size',
'random_reauth_delay',
'recon_default',
'recon_max'
] %}
{%- for opt in opt_list %}
{%- if minion.get(opt) %}
{{ opt }}: {{ minion.get(opt) }}
{%- endif %}
{%- endfor %}
{%- if minion.grains_cache is defined %}
grains_cache: {{ minion.grains_cache }}
{%- endif %}
{%- if minion.recon_randomize is defined %}
recon_randomize: {{ minion.recon_randomize }}
{%- endif %}
{%- if minion.rejected_retry is defined %}
rejected_retry: {{ minion.rejected_retry }}
{%- endif %}

{%- set excluded_keys = ('master', 'system', 'public_keys', 'private_keys', 'known_hosts', '__reclass__', '_secret', '_param') %}


+ 7
- 0
tests/pillar/master_api.sls View File

@@ -16,6 +16,13 @@ salt:
engine: salt
source:
engine: local
ext_pillars:
1:
module: cmd_json
params: '"echo {\"arg\": \"val\"}"'
2:
module: cmd_yaml
params: /usr/local/bin/get_yml.sh
environment:
prd:
formula: {}

Loading…
Cancel
Save