added firewalld pillars and state

This commit is contained in:
Jonas Forsberg 2020-08-14 11:27:53 +02:00
parent 7b5e31aec7
commit 54e03c14f9
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9
5 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,10 @@
include:
- firewalld.kde-connect
firewalld:
zones:
public:
default: True
services:
ssh:
dhcpv6-client:

View File

@ -0,0 +1,10 @@
firewalld:
services:
kde-connect:
ports:
- 1714-1764/tcp
- 1714-1764/udp
zones:
public:
services:
kde-connect:

View File

@ -5,6 +5,7 @@ base:
- firefox - firefox
- hosts - hosts
- repos.google_chrome - repos.google_chrome
- firewalld
{% if grains['os'] == "SUSE" -%} {% if grains['os'] == "SUSE" -%}
- repos.packman - repos.packman
{% endif %} {% endif %}

23
salt/states/firewalld.sls Normal file
View File

@ -0,0 +1,23 @@
{% if pillar['firewalld']['services'] is defined %}
{% for service, args in pillar['firewalld']['services'].items() %}
Adding {{ service }} firewalld service:
firewalld.service:
- name: {{ service }}
- ports: {{ args['ports'] }}
{% endfor %}
{% endif %}
{% if pillar['firewalld']['zones'] is defined %}
{% for zone, args in pillar['firewalld']['zones'].items() %}
configure {{ zone }} firewalld zone:
firewalld.present:
- name: {{ zone }}
- default: {{ args['default'] if args['default'] is defined else False }}
{% if args['services'] is defined %}
- services:
{% for service, args in args['services'].items() -%}
- {{ service }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}

View File

@ -6,3 +6,4 @@ base:
- vim - vim
- firefox - firefox
- sudo - sudo
- firewalld