29 lines
662 B
YAML
29 lines
662 B
YAML
---
|
|
- name: Configurer UFW sur Ubuntu
|
|
hosts: ubuntu
|
|
become: yes
|
|
tasks:
|
|
- name: Installer UFW
|
|
ansible.builtin.apt:
|
|
name: ufw
|
|
state: present
|
|
|
|
- name: Autoriser SSH
|
|
community.general.ufw:
|
|
rule: allow
|
|
port: '22'
|
|
proto: tcp
|
|
|
|
- name: Autoriser MySQL seulement depuis le réseau privé des VMs
|
|
community.general.ufw:
|
|
rule: allow
|
|
from_ip: "{{ mysql_network_cidr }}"
|
|
to_port: "{{ mysql_port }}"
|
|
proto: tcp
|
|
|
|
- name: Activer UFW avec refus entrant par défaut
|
|
community.general.ufw:
|
|
state: enabled
|
|
policy: deny
|
|
direction: incoming
|