瀏覽代碼

Merge 7883127581 into 0cbeada0ab

pull/59/merge
Georg 5 月之前
父節點
當前提交
74729be6d3
沒有連結到貢獻者的電子郵件帳戶。
共有 2 個檔案被更改,包括 19 行新增1 行删除
  1. +16
    -1
      firewalld/zones.sls
  2. +3
    -0
      pillar.example

+ 16
- 1
firewalld/zones.sls 查看文件

@@ -3,6 +3,7 @@
# This state ensures that /etc/firewalld/zones/ exists.
#
{% from "firewalld/map.jinja" import firewalld with context %}
{%- set zones = firewalld.get('zones', {}) %}

directory_firewalld_zones:
file.directory: # make sure this is a directory
@@ -21,7 +22,7 @@ directory_firewalld_zones:
#
# This defines a zone configuration, see firewalld.zone (5) man page.
#
{% for k, v in salt['pillar.get']('firewalld:zones', {}).items() %}
{% for k, v in zones.items() %}
{% set z_name = v.name|default(k) %}

/etc/firewalld/zones/{{ z_name }}.xml:
@@ -44,3 +45,17 @@ directory_firewalld_zones:
zone: {{ v|json }}

{% endfor %}

{%- if firewalld.get('purge_zones', False) %}
{%- set zone_names = zones.keys() %}
{%- for file in salt['file.find']('/etc/firewalld/zones', name='*.xml', print='name', type='f') %}

{%- if file.replace('.xml', '') not in zone_names %}
/etc/firewalld/zones/{{ file }}:
file.absent:
- watch_in:
- cmd: reload_firewalld
{%- endif %}

{%- endfor %}
{%- endif %}

+ 3
- 0
pillar.example 查看文件

@@ -99,6 +99,9 @@ firewalld:
entries:
- 2a01::1

# Delete zones not defined under "zones"
purge_zones: False

zones:
public:
short: Public

Loading…
取消
儲存