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



Salt master with multiple ``ext_pillars``: 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: Salt master with API:



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

worker_threads: {{ master.worker_threads }} worker_threads: {{ master.worker_threads }}
timeout: {{ master.command_timeout }} 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 }} max_open_files: {{ master.max_open_files }}
{%- endif %} {%- 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') }} state_output: {{ master.get('state_output', 'changes') }}


auto_accept: True auto_accept: True
{%- endif %} {%- endif %}


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


{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}
{%- 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' {%- if master.pillar.engine == 'reclass'
or (master.pillar.engine == 'composite' and or (master.pillar.engine == 'composite' and

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

{%- 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: master:
{%- for master in minion.masters %} {%- for master in minion.masters %}
- {{ master.host }} - {{ master.host }}
{%- endfor %} {%- endfor %}

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

{%- else %} {%- else %}

master: {{ minion.master.host }} master: {{ minion.master.host }}

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

id: {{ minion.id | default(system.name~"."~system.domain) }} 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) }} {{ opt }}: {{ minion.get(opt) }}
{%- endif %} {%- endif %}
{%- endfor %} {%- 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') %} {%- set excluded_keys = ('master', 'system', 'public_keys', 'private_keys', 'known_hosts', '__reclass__', '_secret', '_param') %}



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

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

Loading…
Cancel
Save