cmd = 'ufw --force enable' if enabled else 'ufw disable' | cmd = 'ufw --force enable' if enabled else 'ufw disable' | ||||
__salt__['cmd.run'](cmd) | __salt__['cmd.run'](cmd) | ||||
def add_rule(rule): | def add_rule(rule): | ||||
cmd = "ufw " + rule | cmd = "ufw " + rule | ||||
out = __salt__['cmd.run'](cmd, python_shell=True) | out = __salt__['cmd.run'](cmd, python_shell=True) | ||||
# __salt__['cmd.run']("ufw reload") # why reload after adding a rule? :/ | |||||
return out | return out |
- name: ufw logging off | - name: ufw logging off | ||||
- unless: "grep 'LOGLEVEL=off' /etc/ufw/ufw.conf" | - unless: "grep 'LOGLEVEL=off' /etc/ufw/ufw.conf" | ||||
{% else %} | {% else %} | ||||
#ufw: | #ufw: | ||||
#ufw: | #ufw: |