Download, install and configure UFW rules using Ansible
¶
Quick role to configure UFW in your machines to allow local IP's and Tailscale traffic in.
Source Code
You cand find the source code to follow this guide on my Github
UFW Configuration Role for Ansible
¶
This Ansible role configures UFW with basic security rules
:¶
- Allows SSH if
allow_ssh: true
- Allows all outgoing traffic
- Blocks all incoming traffic by default
- Allows internal LAN access (
local_subnet
) - Allows all Tailscale traffic (
100.64.0.0/10
) - Enables UFW
Variables
:¶
Customize in vars/main.yml
:
vars/main.yaml | |
---|---|
ssh_port
: SSH port (default: 22)allow_ssh
: Whether to allow SSH (default: true)local_subnet
: Your LAN subnet (default: "192.168.1.0/24")
Create the playbook
¶
Write a simple playbook that calls the role:
Run the playbook
¶
run: | |
---|---|