2016-01-19 22:15:08 +01:00
|
|
|
# == State: firewalld.zones
|
2014-08-23 16:44:48 +02:00
|
|
|
#
|
|
|
|
# This state ensures that /etc/firewalld/zones/ exists.
|
|
|
|
#
|
2016-01-19 22:15:08 +01:00
|
|
|
{% from "firewalld/map.jinja" import firewalld with context %}
|
|
|
|
|
|
|
|
directory_firewalld_zones:
|
2014-08-23 16:44:48 +02:00
|
|
|
file.directory: # make sure this is a directory
|
2016-01-19 22:15:08 +01:00
|
|
|
- name: /etc/firewalld/zones
|
2014-08-23 16:44:48 +02:00
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 750
|
|
|
|
- require:
|
2016-01-19 22:15:08 +01:00
|
|
|
- pkg: package_firewalld # make sure package is installed
|
2017-03-10 20:14:51 +01:00
|
|
|
- require_in:
|
|
|
|
- service: service_firewalld
|
|
|
|
- watch_in:
|
|
|
|
- cmd: reload_firewalld # reload firewalld config
|
2014-08-23 16:44:48 +02:00
|
|
|
|
2016-01-19 22:15:08 +01:00
|
|
|
# == Define: firewalld.zones
|
2014-08-23 16:44:48 +02:00
|
|
|
#
|
|
|
|
# This defines a zone configuration, see firewalld.zone (5) man page.
|
|
|
|
#
|
|
|
|
{% for k, v in salt['pillar.get']('firewalld:zones', {}).items() %}
|
|
|
|
{% set z_name = v.name|default(k) %}
|
|
|
|
|
|
|
|
/etc/firewalld/zones/{{ z_name }}.xml:
|
2016-01-19 22:15:08 +01:00
|
|
|
file.managed:
|
2014-08-23 16:44:48 +02:00
|
|
|
- name: /etc/firewalld/zones/{{ z_name }}.xml
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 644
|
|
|
|
- source: salt://firewalld/files/zone.xml
|
|
|
|
- template: jinja
|
|
|
|
- require:
|
2016-01-19 22:15:08 +01:00
|
|
|
- pkg: package_firewalld # make sure package is installed
|
|
|
|
- file: directory_firewalld_zones
|
2017-03-10 20:14:51 +01:00
|
|
|
- require_in:
|
|
|
|
- service: service_firewalld
|
|
|
|
- watch_in:
|
|
|
|
- cmd: reload_firewalld # reload firewalld config
|
2014-08-23 16:44:48 +02:00
|
|
|
- context:
|
|
|
|
name: {{ z_name }}
|
2016-06-02 02:19:29 +02:00
|
|
|
zone: {{ v|json }}
|
2014-08-23 16:44:48 +02:00
|
|
|
|
|
|
|
{% endfor %}
|