Files
Kamino/roles/ufw/defaults/main.yml
T
Defame1297andClaude Opus 5.5 e18db424ec
Build / build (pull_request) Successful in 11s
Lint / lint (pull_request) Failing after 25s
Molecule / molecule (pull_request) Failing after 5m42s
feat(ufw): add the ufw role
Copied from the environment repository's local role. The files are
identical except: galaxy namespace mortis; comments, argument_specs
descriptions and the README scrubbed of environment references (issue
numbers, CI runs, playbooks, inventory paths and groups, scripts and
caller roles by name), with the technical explanation kept and reworded
generically; the stray-variable guard's fail message drops its issue
reference; the molecule scenario calls the role by its FQCN
(mortis.kamino.ufw), follows the Kamino scenario conventions
(kamino-molecule header, scenario.test_sequence) and no longer sets
ANSIBLE_COLLECTIONS_PATH or ANSIBLE_ROLES_PATH. No variable, default,
argument_specs type or task logic changed; the test coverage is the same.

The README follows the other Kamino roles: purpose, the main,
service_rules and orphan_rules entry points, variables, and example
plays with the FQCN and tasks_from. The meta licence stays
GPL-3.0-or-later AND GPL-3.0-only (templates/before.rules.j2 is derived
from ufw's own file, already annotated in REUSE.toml and NOTICE).
galaxy.yml's dependency comment names ufw as a community.general user.

Not verified locally: the molecule scenario (it runs on the
kamino-molecule runner in CI) and ansible-test sanity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-14 16:43:29 +00:00

54 lines
2.4 KiB
YAML

---
ufw_enabled: true
ufw_manage_rules: true
ufw_defaults:
incoming: deny
outgoing: allow
routed: deny
ufw_logging: "on"
# Lock-out guard: with a deny/reject incoming default the play refuses to run
# unless an allow/limit rule for this TCP port is in the rule list, since the
# default is applied before the rules and a missing rule cuts the SSH session.
ufw_require_ssh_allow: true
ufw_ssh_port: "{{ ansible_port | default(22, true) }}"
ufw_rules: []
ufw_before_rules: []
# Keys/values written into /etc/ufw/sysctl.conf so ufw's stock file does not
# reset values set by mortis.kamino.system_baseline. Set per group of hosts.
ufw_sysctl_overrides: []
# service_rules entry point. The owner tag is written into each rule's
# comment as `<prefix>[<owner>:<key>]: <text>`; stale detection reads it back
# from `ufw show added`. The regex captures (owner, key) and must match the tag
# built from the prefix: change both together, and note that changing either
# orphans every rule already tagged.
ufw_tag_prefix: ansible-ufw
ufw_tag_regex: "comment 'ansible-ufw\\[([a-z0-9_]+):([0-9a-f]{10})\\]:"
# Characters allowed in a tagged comment: printable ASCII without the single
# quote (it breaks the ufw module) and the backslash.
ufw_tag_comment_regex: '^[] -&(-[^-~]*\Z'
# Finds the port tokens of a rule line (comment removed): a number or a range or list such as
# 20:30 or 22,80, followed by /tcp, /udp, a space or the end, and not part of an address,
# interface name or CIDR. A line is deleted as stale or orphaned only with exactly one plain
# numeric token that is not ufw_ssh_port; every other line may carry SSH and is kept.
ufw_port_token_regex: '(?<![0-9A-Za-z_.:/-])[0-9]+(?::[0-9]+)?(?:,[0-9]+(?::[0-9]+)?)*(?=/(?:tcp|udp)|[ ]|$)'
# Owner names no service may use: `base` is reserved for the base play.
ufw_reserved_owners: [base]
ufw_service_state: present
# false: stale rules of the owner are only reported. true: they are deleted
# after every desired rule was applied.
ufw_purge_stale: false
# orphan_rules entry point. ufw_managed_owners has NO default on purpose: the
# entry point does nothing while it is undefined or empty (fail closed). false: orphaned
# rules (tagged, owner neither managed nor reserved) are only reported. true: they are deleted.
# The default stays false; a caller that wants the purge sets true in the task vars of its
# orphan_rules call.
ufw_purge_orphans: false