This commit is contained in:
2026-02-13 08:47:00 +02:00
parent fc5988070d
commit 352019f6ef
4 changed files with 106 additions and 1 deletions

View File

@@ -7,6 +7,9 @@
# Busybox-safe PATH prefix for all remote raw calls on DEV1
pathprefix: "PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH; "
# Invocation context (default: manual; scheduler wrapper sets is_run_by=scheduler)
is_run_by_effective: "{{ is_run_by | default('manual') }}"
# DEV1 credentials (stable, like rebootin222)
dev1_user: "root"
dev1_pass: "wavewave"
@@ -81,6 +84,7 @@
- "image_sha256={{ image_sha256 | default('UNSET') }}"
- "afterupgrade_routing_key={{ afterupgrade_routing_key | default('UNSET') }}"
- "inventory_hostname={{ inventory_hostname }}"
- "is_run_by={{ is_run_by_effective }}"
# ====== NEW: pick up force-upgrade flag from CLI and TEMP override ======
- name: Read force-upgrade flag from CLI (supports -e force-upgrade=yes)
@@ -940,6 +944,40 @@
- "reboot_seconds={{ _reboot_seconds | default(0) }}"
- "reboot_minutes={{ _reboot_minutes | default(0) }}"
- name: Scheduler mode compute action_restart_timestamp
when: is_run_by_effective == 'scheduler'
delegate_to: localhost
ansible.builtin.set_fact:
action_restart_now_ts: "{{ lookup('pipe', 'date +%s') | int }}"
action_restart_timestamp: "{{ (lookup('pipe', 'date +%s') | int) + (_reboot_seconds | int) }}"
changed_when: false
- name: Scheduler mode publish action_restart_timestamp custom field to control queue
when: is_run_by_effective == 'scheduler'
delegate_to: localhost
ansible.builtin.uri:
url: "http://{{ rmq_host }}:{{ rmq_port }}/api/exchanges/{{ rmq_vhost|urlencode }}/{{ rmq_exchange|urlencode }}/publish"
method: POST
user: "{{ rmq_user }}"
password: "{{ rmq_pass }}"
force_basic_auth: true
status_code: 200
headers:
content-type: "application/json"
body_format: json
body:
properties:
content_type: "application/json"
routing_key: "{{ control_queue }}"
payload: "{{ {
'inscope_device': (ansible_hostname | default(inventory_hostname)),
'task_name': 'custom_field_set',
'task_add1': 'action_restart_timestamp',
'task_result': (action_restart_timestamp | string)
} | to_json }}"
payload_encoding: "string"
changed_when: false
- name: Build human-readable reboot phrase
delegate_to: localhost
ansible.builtin.set_fact:
@@ -1587,6 +1625,7 @@
correlation_id: "{{ au_correlation_id }}"
original_emitted_at: "{{ au_original_emitted_at }}"
schema_version: 1
is_run_by: "{{ is_run_by_effective }}"
when: au_delay_sec is defined
delegate_to: localhost