Extending salt minion and slat master params.
Change-Id: Ia9410364a82ac84889b80b30380ec5f897c7165c
diff --git a/README.rst b/README.rst
index f0abbc4..fd15b19 100644
--- a/README.rst
+++ b/README.rst
@@ -43,8 +43,22 @@
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:
diff --git a/salt/files/master.conf b/salt/files/master.conf
index ce24461..d6fc531 100644
--- a/salt/files/master.conf
+++ b/salt/files/master.conf
@@ -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 @@
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 @@
{%- 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
diff --git a/salt/files/minion.conf b/salt/files/minion.conf
index fe028b4..87bb5b4 100644
--- a/salt/files/minion.conf
+++ b/salt/files/minion.conf
@@ -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') %}
diff --git a/tests/pillar/master_api.sls b/tests/pillar/master_api.sls
index 4c63ea3..dab63e4 100644
--- a/tests/pillar/master_api.sls
+++ b/tests/pillar/master_api.sls
@@ -16,6 +16,13 @@
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: {}