Commit Graph
9 Commits
Author SHA1 Message Date
Defame1297 42c391ccbe fix(cloudflared): quote the mint POST status assertion in verify.yml
Build / build (pull_request) Successful in 17s
Lint / lint (pull_request) Successful in 1m39s
Molecule / molecule (pull_request) Successful in 2m20s
The plain scalar `cloudflared_test_posts[0] is search('"status": 200')`
holds ': ', so YAML parsed it as a one-key mapping and ansible-core
refused it ("Conditional expressions must be strings"). A folded block
scalar keeps it a string.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 15:56:30 +00:00
Defame1297 701226f499 fix(cloudflared): escape the stub's shell variables in molecule.yml
Build / build (pull_request) Successful in 19s
Lint / lint (pull_request) Successful in 1m23s
Molecule / molecule (pull_request) Failing after 2m21s
molecule interpolates environment variables in molecule.yml, so `$1`
and `$*` in the embedded stub script failed the config parse ("Invalid
placeholder") before any step ran. `$$` renders as a literal `$`.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 15:11:21 +00:00
Defame1297 92534a486e test(cloudflared): stop the API stub only while its pid is still the stub
Build / build (pull_request) Successful in 17s
Lint / lint (pull_request) Successful in 2m11s
Molecule / molecule (pull_request) Failing after 1s
Cleanup now checks /proc/<pid>/cmdline before it signals the pid, so a
reused pid is never killed, and removes the pid file afterwards.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 14:57:34 +00:00
Defame1297 eaa5d2f4ee fix(cloudflared): query DNS per hostname and validate config.yml first
The overwrite guard listed the zone's first 100 records only, so a
record further on went unseen. It now queries each ingress hostname by
name and compares names case-insensitively, and the prune listing pages
through result_info.total_pages. Query values are urlencoded. The
template task validates config.yml with cloudflared before it replaces
the file; the rendered content is unchanged. The API stub filters by
name and pages to match.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 14:55:59 +00:00
Defame1297 fd1e9b67dd fix(cloudflared): refuse unsafe hostnames, names, paths and tunnel ids
Ingress hostnames must be lowercase, with an optional leading *. and no
whitespace: they land unquoted in config.yml. The service account names
and directories must hold no newline or %, which the unit would read as
directives, and the directories must be absolute. A set tunnel id must
be a lowercase UUID, the shape the stale-credentials search relies on.
Each refusal has a negative case in the scenario.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 14:51:13 +00:00
Defame1297 ee0fa0e89e test(cloudflared): cover a tunnel lookup that fails with another status
Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 14:22:22 +00:00
Defame1297 fea99a8207 fix(cloudflared): reach the re-mint message after a 404 tunnel lookup
A lookup that still returned 404 after its retries failed the lookup
task itself, whose output no_log hides, so the message with the re-mint
steps never ran. The lookup now ignores its own failure; the next task
fails with the re-mint steps for a 404 or a deleted tunnel, and a new
one fails with the HTTP status for any other lookup error.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 14:22:22 +00:00
Defame1297 9a626962a5 test(cloudflared): add the default molecule scenario
Runs without Cloudflare and without a real cloudflared: a stub of the
Cloudflare API on the controller's loopback answers the tunnel, zone and
DNS record calls through cloudflared_api_base_url, a stub binary stands
in for the daemon, and the releases come from file:// URLs.

Covers the converge with an update through _binary_update and its
idempotence, the rendered files and the running unit, the input asserts,
the deleted-tunnel and DNS guards, a stale hash and a failed checksum,
the mint entry point (as child processes outside CI) and the remove
path. The cloudflare_dns calls cannot reach the stub and are not run.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 14:22:16 +00:00
Defame1297 e308683431 feat(cloudflared): add the cloudflared role
Installs cloudflared as a systemd service for a locally managed
Cloudflare Tunnel: checks that the tunnel exists, manages its proxied
CNAMEs, renders config.yml and the credentials file, and updates the
binary through the internal _binary_update role. The opt-in mint entry
point creates the tunnel and registers its id and credentials as no_log
facts for the calling play to persist.

Validation runs first under always and asserts the tunnel secrets with
the mint instructions; the secrets stay optional in the argument spec on
purpose. cloudflared_manage_dns lets the records be managed elsewhere.
A removal now ends the role.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 14:22:16 +00:00