ansible/roles/firewalld/tasks/main.yml

38 lines
796 B
YAML
Raw Permalink Normal View History

2022-12-14 17:43:16 +01:00
---
- name: Install firewalld
2022-12-14 17:43:16 +01:00
package:
name: firewalld
state: present
- name: "Make sure FirewallD is running"
ansible.builtin.systemd:
2022-12-14 17:43:16 +01:00
name: firewalld
state: started
enabled: true
2022-12-14 17:43:16 +01:00
- name: Open SSH port in firewall
ansible.posix.firewalld:
service: ssh
permanent: yes
state: enabled
immediate: yes
#this is seperate so you don't accidentally remove it
- name: Open services in firewall
ansible.posix.firewalld:
service: "{{ item }}"
permanent: yes
state: enabled
immediate: yes
with_items: "{{ firewall_services }}"
- name: Open ports in firewall
ansible.posix.firewalld:
port: "{{ item }}"
permanent: yes
state: enabled
immediate: yes
with_items: "{{ firewall_ports }}"
when: firewall_ports is defined