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
This commit is contained in:
1 parent
560dc620a3
commit
e308683431
16 files changed
+1182
No files matched your search
@@ -0,0 +1,32 @@
|
||||
---
|
||||
- name: Validate the role inputs
|
||||
ansible.builtin.import_tasks: validate.yml
|
||||
tags: [cloudflared, always]
|
||||
|
||||
# The removal ends the role: none of the tasks below runs, so a removed daemon is not
|
||||
# installed and configured again in the same run.
|
||||
- name: Remove cloudflared (explicit only)
|
||||
ansible.builtin.include_tasks: remove.yml
|
||||
when: cloudflared_remove | bool
|
||||
tags: [cloudflared, remove]
|
||||
|
||||
- name: Install, configure and update cloudflared
|
||||
when: not (cloudflared_remove | bool)
|
||||
block:
|
||||
- name: Include prerequisites
|
||||
ansible.builtin.include_tasks: prereqs.yml
|
||||
tags: [cloudflared, prereqs, always]
|
||||
|
||||
- name: Install cloudflared if missing
|
||||
ansible.builtin.include_tasks: install.yml
|
||||
when: not __cloudflared_installed
|
||||
tags: [cloudflared, install]
|
||||
|
||||
- name: Configure cloudflared
|
||||
ansible.builtin.include_tasks: configure.yml
|
||||
tags: [cloudflared, configure, health]
|
||||
|
||||
- name: Ensure cloudflared is up-to-date
|
||||
ansible.builtin.include_tasks: update.yml
|
||||
when: cloudflared_update | bool
|
||||
tags: [cloudflared, update]
|
||||
Reference in new issue
Block a user