forked from UtahDave/salt-states
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ret.sls
41 lines (38 loc) · 1.04 KB
/
ret.sls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# vi: set ft=yaml.jinja :
{% set fun_args = data.fun_args[0] %}
{% if 'pillar' in fun_args %}
{% set pillar = fun_args['pillar'] %}
{% if 'orchestrate' in pillar %}
{% set orchestrate = pillar['orchestrate'] %}
{% else %}
{% set orchestrate = False %}
{% endif %}
{% else %}
{% set orchestrate = False %}
{% endif %}
{% if 'saltenv' in fun_args %}
{% set saltenv = fun_args['saltenv'] %}
{% else %}
{% set saltenv = 'base' %}
{% endif %}
{% if data.fun == 'state.highstate'
and data.retcode == 0
and not orchestrate %}
{% for return in data.return.values() %}
{% if return.changes|length > 0
and return.name != 'mine.update' %}
state_sls_orchestrate:
cmd.state.sls:
- tgt: 'G@environment:{{ saltenv }} and not {{ data.id }}'
- expr_form: compound
- arg:
- orchestrate
- kwarg:
queue: True
pillar:
related: {'minion': '{{ data.id }}'}
saltenv: {{ saltenv }}
{% break %}
{% endif %}
{% endfor %}
{% endif %}