feat: ansible: install and open ssh port using ufw
This commit is contained in:
parent
67de93dad1
commit
304dc483b6
1 changed files with 26 additions and 0 deletions
26
ansible/roles/ufw/tasks/main.yml
Normal file
26
ansible/roles/ufw/tasks/main.yml
Normal file
|
@ -0,0 +1,26 @@
|
|||
- name: Install ufw
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
pkg:
|
||||
- ufw
|
||||
|
||||
- name: Set logging
|
||||
become: true
|
||||
community.general.ufw:
|
||||
logging: "on"
|
||||
|
||||
- name: Allow port 22 and enable UFW
|
||||
become: true
|
||||
community.general.ufw:
|
||||
state: enabled
|
||||
rule: allow
|
||||
proto: tcp
|
||||
port: "22"
|
||||
|
||||
- name: Enable and start ufw service
|
||||
become: true
|
||||
ansible.builtin.service:
|
||||
name: ufw
|
||||
enabled: true
|
||||
state: started
|
Loading…
Reference in a new issue