39 lines
966 B
YAML
Executable File
39 lines
966 B
YAML
Executable File
---
|
|
# open-all-ports.yml
|
|
#
|
|
# Opens all inbound ports on the target Ubuntu servers.
|
|
#
|
|
# Default behavior: UFW stays enabled but its default incoming
|
|
# policy is set to allow, so every port is reachable.
|
|
#
|
|
# To turn the firewall OFF entirely instead, run with:
|
|
# ansible-playbook -i inventory.ini open-all-ports.yml -e "disable_ufw=true"
|
|
#
|
|
# Uses the community.general.ufw module.
|
|
#
|
|
# Usage:
|
|
# ansible-playbook -i inventory.ini open-all-ports.yml
|
|
|
|
- name: Open all inbound ports
|
|
hosts: ubuntu_servers
|
|
become: true
|
|
|
|
vars:
|
|
disable_ufw: false
|
|
|
|
tasks:
|
|
- name: Set default incoming policy to allow (opens all ports)
|
|
community.general.ufw:
|
|
direction: incoming
|
|
policy: allow
|
|
|
|
- name: Set default outgoing policy to allow
|
|
community.general.ufw:
|
|
direction: outgoing
|
|
policy: allow
|
|
|
|
- name: Optionally disable UFW entirely
|
|
community.general.ufw:
|
|
state: disabled
|
|
when: disable_ufw | bool
|