Module's function output to variable in saltstack state [Solved] -
i'm trying develop simple formula saltstack flush iptables rules , apply formula updated rules, need switch input policy accept , flush rules. i'm trying verify in following way:
{% set policy = salt['pillar.get']('iptables.get_policy','') %} {% if policy == "accept" %} flush rules: iptables.flush: require: - default accept {% endif %}
full code of sls looks like:
include: - iptables default accept: iptables.set_policy: - chain: input - policy: accept {% set policy = salt['iptables.get_policy'] %} {% if policy == "accept" %} flush rules: iptables.flush: require: - default accept {% endif %} iptables reapply: require: - sls: iptables
apparently doesn't work, advise i'm doing wrong , if that's possible @ all?
update
in case if needs similar formula, here's formula works me:
include: - iptables default accept: iptables.set_policy: - chain: input - policy: accept - order: 1 iptables.flush: module.run: - name: iptables.flush - order: 2
i haven't tested this, think need call function.
{% set policy = salt['iptables.get_policy']() %}
make sure add ()
call function
Comments
Post a Comment