Add UFW firewall for debian based distro
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
b7c5c87319
commit
f5c29bad3f
4 changed files with 29 additions and 2 deletions
|
@ -10,7 +10,9 @@
|
|||
- journald
|
||||
- sshd
|
||||
- role: timesyncd
|
||||
when: ansible_facts['os_family'] == "Ubuntu"
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
- role: ufw
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
|
||||
- name: Resolver
|
||||
hosts: resolver
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
- journald
|
||||
- sshd
|
||||
- role: timesyncd
|
||||
when: ansible_facts['os_family'] == "Ubuntu"
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
- role: ufw
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
post_tasks:
|
||||
- name: Clean cloud-init
|
||||
ansible.builtin.command: cloud-init clean
|
||||
|
|
|
@ -19,3 +19,12 @@
|
|||
mode: "0644"
|
||||
notify:
|
||||
- Restart knot resolver
|
||||
|
||||
- name: Allow port 53 (DNS)
|
||||
community.general.ufw:
|
||||
rule: allow
|
||||
port: "{{ item.port }}"
|
||||
proto: "{{ item.proto }}"
|
||||
with_items:
|
||||
- { port: "53", proto: "tcp" }
|
||||
- { port: "53", proto: "udp" }
|
||||
|
|
14
ansible/roles/ufw/tasks/main.yml
Normal file
14
ansible/roles/ufw/tasks/main.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- name: Install UFW
|
||||
ansible.builtin.apt:
|
||||
name: ufw
|
||||
|
||||
- name: Allow 22/tcp (SSH)
|
||||
community.general.ufw:
|
||||
rule: allow
|
||||
port: "22"
|
||||
proto: tcp
|
||||
|
||||
- name: Enable UFW
|
||||
community.general.ufw:
|
||||
state: enabled
|
Loading…
Reference in a new issue