The base role's UFW tasks in roles/base/tasks/main.yml currently run in this order:
policy: deny (default deny all incoming)Between steps 1 and 2, UFW is active with zero allow rules. While UFW typically doesn't drop established connections, this ordering violates the best practice of "allow before deny" and can cause issues depending on how UFW handles the policy change mid-session.
Goals:
Non-Goals:
Swap the task order: allow SSH and other ports first, then enable UFW with the deny policy. This ensures the firewall is enabled with all necessary rules already in place.
Alternatives considered:
route rule to allow the current Ansible connection before enabling UFW: overcomplicated, UFW's rule ordering is sufficient.ufw reset before enabling: unnecessary and would remove any existing custom rules.