feat: add ufw rule
This commit is contained in:
parent
5e2cafaf47
commit
2ebdb06b5e
3 changed files with 27 additions and 2 deletions
|
|
@ -34,3 +34,10 @@
|
|||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: Open HTTP ports in firewall
|
||||
community.general.ufw:
|
||||
port: '{{ item }}'
|
||||
rule: 'allow'
|
||||
loop:
|
||||
- 'http'
|
||||
- 'https'
|
||||
|
|
|
|||
18
roles/any.tools.ufw/tasks/main.yml
Normal file
18
roles/any.tools.ufw/tasks/main.yml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- name: Ensure UFW is installed
|
||||
apt:
|
||||
name: ufw
|
||||
state: present
|
||||
|
||||
- name: Set default policy to deny
|
||||
community.general.ufw:
|
||||
default: 'deny'
|
||||
|
||||
- name: Allow SSH connections
|
||||
community.general.ufw:
|
||||
port: 2222
|
||||
rule: 'allow'
|
||||
|
||||
- name: Ensure UFW is enabled
|
||||
community.general.ufw:
|
||||
state: 'enabled'
|
||||
Loading…
Add table
Add a link
Reference in a new issue