Skip to content

Commit

Permalink
Merge pull request #312 from netmanagers/master
Browse files Browse the repository at this point in the history
Allow to specify reactors separatedly for master and minions
  • Loading branch information
aboe76 authored Jun 3, 2017
2 parents be266a1 + 9331997 commit 83433c8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
22 changes: 19 additions & 3 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ salt:
type: runner
cmd: jobs.list_jobs

# optional: these reactors will be configured on the master
# They override reactors configured in
# 'salt:reactors' or the old 'salt:reactor' parameters
reactors:
- 'master/deploy':
- /srv/salt/reactors/deploy.sls

# salt minion config:
minion:

Expand Down Expand Up @@ -177,6 +184,12 @@ salt:
- 1.0
interval: 10

# Optional reactors: these reactors will be configured on the minion
# They override reactors configured in
# 'salt:reactors' or the old 'salt:reactor' parameters
reactors:
- 'minion/deploy':
- /srv/salt/reactors/deploy.sls

# salt cloud config
cloud:
Expand Down Expand Up @@ -235,9 +248,7 @@ salt:
- IAD
- SYD
- HKG
reactor:
- 'deploy':
- /srv/salt/reactors/deploy.sls

ssh_roster:
prod1:
host: host.example.com
Expand All @@ -255,6 +266,11 @@ salt:
pub: |
...........

# These reactors will be configured both in the minion and the master
reactors:
- 'deploy':
- /srv/salt/reactors/deploy.sls

salt_cloud_certs:
aws:
pem: |
Expand Down
2 changes: 1 addition & 1 deletion salt/files/master.d/f_defaults.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file managed by Salt, do not edit by hand!!
# Based on salt version 2016.11 default config
{% set reserved_keys = ['master', 'minion', 'cloud', 'salt_cloud_certs', 'engines', 'lxc.network_profile', 'lxc.container_profile'] -%}
{% set reserved_keys = ['master', 'minion', 'cloud', 'salt_cloud_certs', 'engines', 'lxc.network_profile', 'lxc.container_profile', 'reactors'] -%}
{% set cfg_salt = pillar.get('salt', {}) -%}
{% set cfg_master = cfg_salt.get('master', {}) -%}
{% set default_keys = [] -%}
Expand Down
6 changes: 5 additions & 1 deletion salt/files/master.d/reactor.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#
# This file is managed by Salt! Do not edit by hand!
#
{%- set reactors = salt['pillar.get']('salt:reactor') -%}
{# The parameter reactor is kept for backward compatibility -#}
{%- set reactors = salt['pillar.get']('salt:reactor', []) -%}
{%- set reactors = salt['pillar.get']('salt:reactors', default=reactors, merge=True) -%}
{%- set reactors = salt['pillar.get']('salt:master:reactors', default=reactors, merge=True) -%}

{%- if reactors %}
reactor:
{%- for reactor in reactors %}
Expand Down
2 changes: 1 addition & 1 deletion salt/files/minion.d/f_defaults.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file managed by Salt, do not edit by hand!!
# Based on salt version 2016.11 default config
#
{% set reserved_keys = ['master', 'minion', 'cloud', 'salt_cloud_certs', 'engines', 'beacons'] -%}
{% set reserved_keys = ['master', 'minion', 'cloud', 'salt_cloud_certs', 'engines', 'beacons', 'reactors'] -%}
{% set cfg_salt = pillar.get('salt', {}) -%}
{% set cfg_minion = cfg_salt.get('minion', {}) -%}
{% set default_keys = [] -%}
Expand Down
6 changes: 5 additions & 1 deletion salt/files/minion.d/reactor.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#
# This file is managed by Salt! Do not edit by hand!
#
{%- set reactors = salt['pillar.get']('salt:reactor') -%}
{# The parameter reactor is kept for backward compatibility -#}
{%- set reactors = salt['pillar.get']('salt:reactor', []) -%}
{%- set reactors = salt['pillar.get']('salt:reactors', default=reactors, merge=True) -%}
{%- set reactors = salt['pillar.get']('salt:minion:reactors', default=reactors, merge=True) -%}

{%- if reactors %}
reactor:
{%- for reactor in reactors %}
Expand Down

0 comments on commit 83433c8

Please sign in to comment.