The archive and checksums URLs were hardcoded to the GitHub releases. traefik_release_url (default: the GitHub release directory of traefik_version, as before) lets a host download from a mirror. The Molecule scenario uses it: verify's update path now downloads stand-in releases that prepare.yml builds under /opt/molecule-download (a stub binary answering `version`, its archive and a sha256sum checksums file), so it no longer fetches two more real releases per host. The converge still downloads the real release from GitHub, which keeps the default URL proven. traefik_verify_other_version moves to the scenario's group vars so prepare and verify share it. The update path leaves the stub installed, which the README and verify now state. Verify replaces the fixed 15 s pause with a poll (30 x 2 s) for an "Unable to obtain ACME certificate" log line stamped at or after the running process's ExecMainStartTimestamp, so a line left by the process converge restarted does not count. It fails closed on a missing start time, a missing line or an unparseable stamp. It then asserts NRestarts is 0, since Restart=always would hide a crash. Assisted-by: Claude Code:claude-opus-5-5
213 lines
10 KiB
YAML
213 lines
10 KiB
YAML
---
|
|
argument_specs:
|
|
main:
|
|
short_description: Install, configure, update or remove Traefik as a systemd binary
|
|
description:
|
|
- >-
|
|
Optionally removes Traefik (C(traefik_remove)), installs required packages, the C(traefik) system user and
|
|
group, downloads and checksum-verifies the pinned release on first install, renders the static and dynamic
|
|
configuration, the secret environment file and the systemd unit, re-runs the C(mortis.kamino.ufw) role, and starts the
|
|
service. Optionally updates the binary in place (C(traefik_update)) with rollback.
|
|
- >-
|
|
C(traefik_domain), C(traefik_cloudflare_email) and C(traefik_cloudflare_api_token) have no role default and
|
|
are required. The environment supplies them, typically mapped from its own variables in group_vars.
|
|
options:
|
|
traefik_domain:
|
|
type: str
|
|
description:
|
|
- >-
|
|
DNS zone appended to C(traefik_dashboard_subdomain) and to each C(subdomain) of C(traefik_dynamic_apps) to
|
|
form the Host rule. No role default exists. Supplied by inventory.
|
|
- Required and asserted non-empty at role start by the tasks (not by this spec).
|
|
traefik_update:
|
|
type: bool
|
|
default: false
|
|
description:
|
|
- >-
|
|
When true the update tasks run after configuration. The installed version is compared with
|
|
C(traefik_version) and only a difference triggers a verified download into a staging directory, before
|
|
the service is stopped. The internal C(mortis.kamino._binary_update) role then stops, backs up, swaps,
|
|
restarts and checks the version, with rollback to the backup on failure.
|
|
traefik_remove:
|
|
type: bool
|
|
default: false
|
|
description:
|
|
- >-
|
|
When true the service is stopped and disabled, the unit file and the binary are removed, and the
|
|
C(ansible-ufw[traefik:...]) firewall rules are deleted (ufw must be active on the host, or that last task
|
|
fails). Prerequisites, install, configure and update are skipped for this run.
|
|
traefik_remove_data:
|
|
type: bool
|
|
default: false
|
|
description:
|
|
- Only read while C(traefik_remove) is true. When true C(traefik_config_dir) is deleted recursively, including the ACME store.
|
|
traefik_install_type:
|
|
type: str
|
|
default: binary
|
|
choices: [binary]
|
|
description:
|
|
- Selects the task directory that is included. Only C(binary) exists.
|
|
traefik_version:
|
|
type: str
|
|
description:
|
|
- >-
|
|
Traefik release tag to install, for example C(v3.7.14). The role default is a pinned tag, see
|
|
C(defaults/main.yml); pin it in inventory to move it independently of Collection releases.
|
|
traefik_arch:
|
|
type: str
|
|
default: amd64
|
|
description:
|
|
- Architecture part of the release archive name.
|
|
traefik_os:
|
|
type: str
|
|
default: linux
|
|
description:
|
|
- Operating system part of the release archive name.
|
|
traefik_release_url:
|
|
type: raw
|
|
description:
|
|
- >-
|
|
URL of the directory holding the release archive and C(traefik_<traefik_version>_checksums.txt),
|
|
without a trailing slash. The role default is the Jinja expression
|
|
C(https://github.com/traefik/traefik/releases/download/<traefik_version>); point it at a mirror
|
|
for a host without access to github.com.
|
|
traefik_archive_name:
|
|
type: raw
|
|
description:
|
|
- >-
|
|
Release archive file name. The role default is the Jinja expression
|
|
C(traefik_<traefik_version>_<traefik_os>_<traefik_arch>.tar.gz).
|
|
traefik_local_archive:
|
|
type: str
|
|
default: /tmp/traefik.tar.gz
|
|
description:
|
|
- Download destination of the release archive on the target. Removed after extraction.
|
|
traefik_bin_path:
|
|
type: str
|
|
default: /usr/local/bin/traefik
|
|
description:
|
|
- >-
|
|
Path of the Traefik binary. Used by the service unit, the version checks and removal. Only the
|
|
C(traefik) file of the archive is extracted into its directory, so the file name must stay C(traefik).
|
|
traefik_config_dir:
|
|
type: str
|
|
default: /etc/traefik
|
|
description:
|
|
- >-
|
|
Directory for C(traefik.yml) and the C(logs) directory. The secret file C(traefik.env) is written here
|
|
too. The role defaults of C(traefik_dynamic_dir) and C(traefik_acme_file) are derived from it.
|
|
traefik_dynamic_dir:
|
|
type: str
|
|
default: /etc/traefik/dynamic
|
|
description:
|
|
- Directory watched by the file provider. Holds C(dynamic.yml). The role default is the C(dynamic) subdirectory of C(traefik_config_dir).
|
|
traefik_acme_file:
|
|
type: str
|
|
default: /etc/traefik/acme.json
|
|
description:
|
|
- ACME certificate storage. Created empty when missing and kept mode 0600. The role default is C(acme.json) inside C(traefik_config_dir).
|
|
traefik_service_unit:
|
|
type: str
|
|
default: /etc/systemd/system/traefik.service
|
|
description:
|
|
- Path of the systemd unit file the role writes and, on removal, deletes. The service name stays C(traefik).
|
|
traefik_dns_challenge_resolvers:
|
|
type: list
|
|
elements: str
|
|
default: []
|
|
description:
|
|
- >-
|
|
Resolvers, as C(host:port) or C([ipv6]:port) strings, that the ACME DNS-01 challenge uses to check propagation. Empty omits
|
|
the C(resolvers) block, so Traefik uses the system resolver. Environment-specific, supplied by inventory.
|
|
traefik_user:
|
|
type: str
|
|
default: traefik
|
|
description:
|
|
- System user and group that own the configuration and run the service.
|
|
traefik_log_rotate_frequency:
|
|
type: str
|
|
default: daily
|
|
choices: [hourly, daily, weekly, monthly]
|
|
description:
|
|
- How often logrotate rotates the Traefik logs (C(/etc/logrotate.d/traefik)).
|
|
traefik_log_rotate_count:
|
|
type: int
|
|
default: 14
|
|
description:
|
|
- Number of rotated Traefik log files to keep.
|
|
traefik_log_rotate_max_size:
|
|
type: str
|
|
default: 500M
|
|
description:
|
|
- Size at which a log is rotated even before the interval is due (logrotate C(maxsize), for example C(500M)).
|
|
traefik_dynamic_apps:
|
|
type: raw
|
|
description:
|
|
- >-
|
|
List of extra routed applications, supplied by inventory. The role default is an empty list. Each item is a
|
|
mapping with C(service_name), C(subdomain) (including the trailing dot), C(server_url) and optionally
|
|
C(pass_host_header) (default true).
|
|
traefik_dashboard_enabled:
|
|
type: bool
|
|
default: false
|
|
description:
|
|
- >-
|
|
Serve the Traefik dashboard (C(api@internal)) on C(traefik_dashboard_subdomain). Off by default. The play
|
|
fails when it is true and C(traefik_dashboard_basicauth_users) is empty, so the dashboard is never
|
|
deployed without authentication.
|
|
traefik_dashboard_subdomain:
|
|
type: str
|
|
default: "traefik."
|
|
description:
|
|
- Prefix, including the trailing dot, placed before C(traefik_domain) for the dashboard Host rule.
|
|
traefik_dashboard_basicauth_users:
|
|
type: raw
|
|
no_log: true
|
|
description:
|
|
- >-
|
|
List of htpasswd lines C(user:hash) for basicAuth on the dashboard router. Required (non-empty) when
|
|
C(traefik_dashboard_enabled) is true and ignored otherwise. The role default is an empty list. These are
|
|
credentials, set them only from a vaulted variable file.
|
|
- The play fails when this is non-empty and C(traefik_dynamic_middlewares) also defines C(dashboard-auth).
|
|
traefik_dynamic_middlewares:
|
|
type: raw
|
|
description:
|
|
- >-
|
|
Mapping of extra middleware name to its Traefik configuration, rendered next to C(default-headers). The
|
|
role default is an empty mapping. The key C(dashboard-auth) is reserved.
|
|
traefik_trusted_proxy_ips:
|
|
type: raw
|
|
description:
|
|
- >-
|
|
List of CIDRs trusted for X-Forwarded-* headers on the websecure entrypoint. The role default is
|
|
C(127.0.0.1/32) and C(::1/128), for a tunnel client (such as cloudflared) that connects over loopback.
|
|
traefik_cloudflare_email:
|
|
type: raw
|
|
no_log: true
|
|
description:
|
|
- >-
|
|
Cloudflare account e-mail for the DNS challenge. Written to C(traefik.env) as C(CF_API_EMAIL) and to the
|
|
ACME resolver. No role default exists. Map it from a vaulted inventory variable.
|
|
- Required and asserted non-empty at role start by the tasks (not by this spec).
|
|
traefik_cloudflare_api_token:
|
|
type: raw
|
|
no_log: true
|
|
description:
|
|
- >-
|
|
Cloudflare API key for the DNS challenge. Written to C(traefik.env) as C(CF_API_KEY). No role default
|
|
exists. Map it from a vaulted inventory variable.
|
|
- Required and asserted non-empty at role start by the tasks (not by this spec).
|
|
traefik_headers:
|
|
type: dict
|
|
description:
|
|
- >-
|
|
Mapping rendered as the C(default-headers) middleware, applied to the websecure entrypoint. The role
|
|
default enables frame deny, XSS filter, nosniff, forced STS with subdomains and preload (15552000
|
|
seconds), SAMEORIGIN frame option and C(X-Forwarded-Proto) https. Overriding replaces the whole mapping.
|
|
traefik_ufw_service_rules:
|
|
type: raw
|
|
description:
|
|
- >-
|
|
Rules the role passes to the C(mortis.kamino.ufw) role as C(ufw_service_rules), owner C(traefik) (entry point
|
|
C(service_rules)). The role default allows ports 80 and 443. Same item schema as C(ufw_service_rules).
|