This commit is contained in:
2025-07-20 14:53:12 +03:00
commit cd2f49ea82
234 changed files with 52038 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
---
- name: Install and configure UFW
hosts: main_server
become: yes
tasks:
- name: Install UFW
apt:
name:
- ufw
state: present
update_cache: yes
- name: Set default deny policy
ufw:
direction: incoming
policy: deny
- name: Allow required ports
ufw:
rule: allow
port: "{{ item.port }}"
proto: "{{ item.proto | default('tcp') }}"
loop:
- { port: "{{ gitea_ssh_port }}", proto: "tcp" }
- { port: "{{ main_ssh_port }}", proto: "tcp" }
- { port: "{{ https_port }}", proto: "tcp" }
- { port: "{{ http_port }}", proto: "tcp" }
- { port: "{{ db_port }}", proto: "tcp" }
- name: Enable UFW
ufw:
state: enabled
- name: restart UFW
service:
name: ufw
state: restarted

View File

@@ -0,0 +1,30 @@
---
# tasks file for firewall
- name: Install UFW
ansible.builtin.apt:
name:
- ufw
state: present
update_cache: yes
- name: Set default deny policy
ufw:
direction: incoming
policy: deny
- name: Allow required ports
ufw:
rule: allow
port: "{{ item.value.port }}"
proto: "{{ item.value.proto | default('tcp') }}"
loop: "{{ ports | dict2items }}"
- name: Enable UFW
ufw:
state: enabled
- name: restart UFW
ansible.builtin.service:
name: ufw
state: restarted