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
|
- journald
|
||||||
- sshd
|
- sshd
|
||||||
- role: timesyncd
|
- role: timesyncd
|
||||||
when: ansible_facts['os_family'] == "Ubuntu"
|
when: ansible_facts['os_family'] == "Debian"
|
||||||
|
- role: ufw
|
||||||
|
when: ansible_facts['os_family'] == "Debian"
|
||||||
|
|
||||||
- name: Resolver
|
- name: Resolver
|
||||||
hosts: resolver
|
hosts: resolver
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
- journald
|
- journald
|
||||||
- sshd
|
- sshd
|
||||||
- role: timesyncd
|
- role: timesyncd
|
||||||
when: ansible_facts['os_family'] == "Ubuntu"
|
when: ansible_facts['os_family'] == "Debian"
|
||||||
|
- role: ufw
|
||||||
|
when: ansible_facts['os_family'] == "Debian"
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Clean cloud-init
|
- name: Clean cloud-init
|
||||||
ansible.builtin.command: cloud-init clean
|
ansible.builtin.command: cloud-init clean
|
||||||
|
|
|
@ -19,3 +19,12 @@
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify:
|
notify:
|
||||||
- Restart knot resolver
|
- 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