1216
This commit is contained in:
@@ -92,6 +92,6 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
|
||||||
- import_playbook: update-indoor6-stable.yml
|
- import_playbook: update-indoor6-stable.patched.yml
|
||||||
vars:
|
vars:
|
||||||
is_run_by: "scheduler"
|
is_run_by: "scheduler"
|
||||||
|
|||||||
@@ -952,32 +952,6 @@
|
|||||||
action_restart_timestamp: "{{ (lookup('pipe', 'date +%s') | int) + (_reboot_seconds | int) }}"
|
action_restart_timestamp: "{{ (lookup('pipe', 'date +%s') | int) + (_reboot_seconds | int) }}"
|
||||||
changed_when: false
|
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
|
- name: Build human-readable reboot phrase
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
@@ -1475,6 +1449,40 @@
|
|||||||
changed_when: true
|
changed_when: true
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Scheduler mode compute reboot_applied flag (gate for action_restart_timestamp)
|
||||||
|
when: is_run_by_effective == 'scheduler'
|
||||||
|
delegate_to: localhost
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
reboot_applied_cf: "{{ (dev2_reboot_sched is defined) and (dev2_reboot_sched.rc is defined) and ((dev2_reboot_sched.rc | int) == 0) }}"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Scheduler mode publish action_restart_timestamp custom field to control queue
|
||||||
|
when: is_run_by_effective == 'scheduler' and (reboot_applied_cf | default(false))
|
||||||
|
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 'indoor-restart-scheduled' tag payload
|
- name: Build 'indoor-restart-scheduled' tag payload
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
tag_restart_sched_payload:
|
tag_restart_sched_payload:
|
||||||
@@ -1705,6 +1713,32 @@
|
|||||||
- "journal={{ (_journal | default([])) | join(' || ') }}"
|
- "journal={{ (_journal | default([])) | join(' || ') }}"
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
|
- name: Scheduler mode report failure to NetBox when update needed but reboot not applied
|
||||||
|
when: is_run_by_effective == 'scheduler' and (((not (version_match | default(false))) or (force_upgrade | default(false)))) and (not ((dev2_reboot_sched is defined) and (dev2_reboot_sched.rc is defined) and ((dev2_reboot_sched.rc | int) == 0)))
|
||||||
|
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_state',
|
||||||
|
'task_result': 'failed'
|
||||||
|
} | to_json }}"
|
||||||
|
payload_encoding: "string"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
- name: Cleanup (always)
|
- name: Cleanup (always)
|
||||||
block:
|
block:
|
||||||
- ansible.builtin.debug:
|
- ansible.builtin.debug:
|
||||||
|
|||||||
Reference in New Issue
Block a user