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
19 lines
899 B
YAML
19 lines
899 B
YAML
---
|
|
# The one download of the cloudflared binary, shared by install.yml (straight onto the live
|
|
# path, since nothing runs yet) and update.yml (into a staging path next to it, before
|
|
# mortis.kamino._binary_update stops the daemon and swaps it in). get_url checks
|
|
# cloudflared_sha256_amd64 before it moves the file to __cloudflared_download_dest, so a failed or
|
|
# mismatching download leaves that path as it was.
|
|
# Tagged install and update: an include does not pass its tags on to the tasks it includes,
|
|
# so under --tags update a task tagged install only would be skipped.
|
|
- name: Download and verify the cloudflared binary
|
|
become: true
|
|
ansible.builtin.get_url:
|
|
url: "{{ cloudflared_download_url }}"
|
|
dest: "{{ __cloudflared_download_dest }}"
|
|
checksum: "sha256:{{ cloudflared_sha256_amd64 }}"
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
tags: [cloudflared, install, update]
|