Moves the traefik role from the environment repository, the first wave 2 role and the first caller of the internal _binary_update role. Against the source: - The update path stages the downloaded, checksum-verified binary in a directory next to the live one and hands the stop, backup, swap, restart, version check and rollback to mortis.kamino._binary_update (include_role with apply tags, so --tags update reaches it). A download or checksum failure still leaves the running service untouched and says so; a failure in the swap keeps the rollback message of _binary_update. - Two small behaviour changes come with _binary_update: the backup is taken whenever a live binary exists (the source skipped it when the binary reported no version), and a failure before the stop no longer restarts the running service. - The legacy name guards (pre-rename variables of the environment) are dropped, as in the wave 1 roles, and the argument_specs and README no longer mention them. - Environment references are gone from comments, the README and the argument_specs: issue numbers, host names, inventory paths, playbooks and the role's own history. The Renovate comment on traefik_version is dropped, since this repository has no manager for it; the README and argument_specs recommend pinning the version in inventory. - meta namespace mortis; the scenario follows the Kamino conventions (header, test_sequence, no provisioner env) and calls the role by FQCN. - The scenario's verify gains a real version bump: down to another release (v3.7.18) and back to the role default with traefik_update, asserting the version, an active unit and no staging directory, backup or download left behind. Changelog fragment, README Roadmap and the CLAUDE.md role list updated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
70 lines
3.0 KiB
YAML
70 lines
3.0 KiB
YAML
---
|
|
# The one download of the Traefik release, shared by install.yml (extracts straight into the
|
|
# live binary's directory, since nothing runs yet) and update.yml (extracts into a staging
|
|
# directory next to it, before the service is stopped). Only the traefik binary is extracted:
|
|
# the archive also holds CHANGELOG.md and LICENSE.md, which do not belong in a bin directory.
|
|
# Input: traefik_download_dir, the directory the binary is extracted into.
|
|
# 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, verify and extract the Traefik binary
|
|
block:
|
|
# force: an archive left in /tmp by an earlier run (an interrupted run, or another tool)
|
|
# would otherwise be kept and then fail the checksum check.
|
|
- name: Download Traefik archive
|
|
ansible.builtin.get_url:
|
|
url: "https://github.com/traefik/traefik/releases/download/{{ traefik_version }}/{{ traefik_archive_name }}"
|
|
dest: "{{ traefik_local_archive }}"
|
|
mode: "0644"
|
|
force: true
|
|
tags: [traefik, install, binary, update]
|
|
|
|
- name: Download Traefik checksums
|
|
ansible.builtin.get_url:
|
|
url: "https://github.com/traefik/traefik/releases/download/{{ traefik_version }}/traefik_{{ traefik_version }}_checksums.txt"
|
|
dest: /tmp/traefik_checksums.txt
|
|
mode: "0644"
|
|
force: true
|
|
tags: [traefik, install, binary, update]
|
|
|
|
- name: Compute SHA256 of Traefik archive
|
|
ansible.builtin.command: sha256sum {{ traefik_local_archive }}
|
|
# The archive is not downloaded under --check, so there is nothing to hash, verify or unpack.
|
|
when: not ansible_check_mode
|
|
register: traefik_sha256
|
|
changed_when: false
|
|
failed_when: traefik_sha256.stdout is not match("^[a-f0-9]{64} ")
|
|
tags: [traefik, install, binary, update]
|
|
|
|
- name: Verify Traefik checksum against official list
|
|
ansible.builtin.shell: |
|
|
grep -F "{{ traefik_sha256.stdout.split()[0] }} {{ traefik_archive_name }}" /tmp/traefik_checksums.txt
|
|
when: not ansible_check_mode
|
|
register: traefik_checksum_verify
|
|
changed_when: false
|
|
failed_when: traefik_checksum_verify.rc != 0
|
|
tags: [traefik, install, binary, update]
|
|
|
|
- name: Extract the Traefik binary
|
|
become: true
|
|
ansible.builtin.unarchive:
|
|
src: "{{ traefik_local_archive }}"
|
|
dest: "{{ traefik_download_dir }}"
|
|
remote_src: true
|
|
include: [traefik]
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
when: not ansible_check_mode
|
|
tags: [traefik, install, binary, update]
|
|
always:
|
|
- name: Remove the downloaded Traefik archive and checksums
|
|
ansible.builtin.file:
|
|
path: "{{ traefik_download_file }}"
|
|
state: absent
|
|
loop:
|
|
- "{{ traefik_local_archive }}"
|
|
- /tmp/traefik_checksums.txt
|
|
loop_control:
|
|
loop_var: traefik_download_file
|
|
tags: [traefik, install, binary, update]
|