Browse Source

Handle loglevel

tags/v0.2.0
Alexandre Anriot 6 years ago
parent
commit
38e788ceb5
2 changed files with 6 additions and 3 deletions
  1. +1
    -0
      pillar.example
  2. +5
    -3
      ufw/init.sls

+ 1
- 0
pillar.example View File

@@ -3,6 +3,7 @@ ufw:
enabled: True

settings:
loglevel: low
ipv6: True
default_input_policy: 'DROP'
default_output_policy: 'ACCEPT'

+ 5
- 3
ufw/init.sls View File

@@ -4,6 +4,8 @@
{% from "ufw/map.jinja" import ufwmap with context %}
{% set default_template = ufw.get('default_template', 'salt://ufw/templates/default.jinja') -%}
{% set sysctl_template = ufw.get('sysctl_template', 'salt://ufw/templates/sysctl.jinja') -%}
{% set settings_cfg = ufw.get('settings', {}) -%}
{% set loglevel = settings_cfg.get('loglevel', 'low') -%}

ufw:
pkg.installed:
@@ -149,10 +151,10 @@ reload-ufw:
cmd.wait:
- name: ufw reload

disable-logging:
set-logging:
cmd.run:
- name: ufw logging off
- unless: "grep 'LOGLEVEL=off' /etc/ufw/ufw.conf"
- name: ufw logging {{ loglevel }}
- unless: "grep 'LOGLEVEL={{ loglevel }}' /etc/ufw/ufw.conf"

{% else %}
#ufw:

Loading…
Cancel
Save