--- argument_specs: main: short_description: "[INTERNAL] Swap a staged binary into place for a systemd service, with rollback" description: - >- [INTERNAL] Called only by roles of this Collection, by its fully qualified name; a direct call from a play fails. Not part of the Collection's public API, so its interface can change in any release. - >- The caller downloads and verifies the new binary and stages it at C(_binary_update_staged_path), on the same filesystem as C(_binary_update_binary_path), before it includes this role. The role refuses to stop the service when nothing executable is staged. - >- Then it reloads systemd, stops the service and waits for it to stop, backs up the live binary to C(<_binary_update_binary_path>.bak) (when there is one), moves the staged file over the live path, starts the service, waits for it to become active and compares the version it reports with C(_binary_update_expected_version). On success the backup is removed. - >- Any failure after the stop restores the backup taken by this run, starts the service again and fails with a message that says whether the restore and the restart worked. A failure before the stop leaves the service running and does not restart it. The staged file is removed in every case. - >- Under C(--check) the role skips the waits and the version check, so a preview against a stopped service does not report a rollback. The stop, backup and start report what they would change. options: _binary_update_service: type: str required: true description: - Name of the systemd unit that runs the binary. _binary_update_binary_path: type: path required: true description: - Path of the live binary that the unit runs. _binary_update_staged_path: type: path required: true description: - >- Downloaded and verified new binary, executable, on the same filesystem as C(_binary_update_binary_path) so that the swap is a rename. Removed by the role whether the update succeeds or fails. _binary_update_version_command: type: list elements: str required: true description: - >- Command, as an argument list, whose output holds the version of the binary at C(_binary_update_binary_path), for example C([/usr/local/bin/traefik, version]). _binary_update_expected_version: type: str required: true description: - Version the new binary must report. A leading C(v) is ignored. _binary_update_version_regex: type: str default: 'v?([0-9]+\.[0-9]+\.[0-9]+)' description: - >- Regular expression with one capture group, the version without a leading C(v). Its first match in the output of C(_binary_update_version_command) is compared with C(_binary_update_expected_version). _binary_update_stop_timeout: type: int default: 60 description: - Seconds to wait for the service to stop. It is checked every 2 seconds. _binary_update_start_timeout: type: int default: 30 description: - Seconds to wait for the service to become active after a start, also after a rollback. It is checked every 2 seconds.