0619
This commit is contained in:
@@ -5,6 +5,11 @@
|
|||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
|
# Wrapper mode:
|
||||||
|
# false (default): standalone behavior (may requeue + end_host)
|
||||||
|
# true: composable behavior for sot-updater-wrapper.yml (no requeue, no end_host)
|
||||||
|
sot_wrapper_mode: false
|
||||||
|
|
||||||
pathprefix: "PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH; "
|
pathprefix: "PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH; "
|
||||||
dev1_user: "root"
|
dev1_user: "root"
|
||||||
dev1_pass: "wavewave"
|
dev1_pass: "wavewave"
|
||||||
@@ -209,6 +214,7 @@
|
|||||||
# --- Requeue control: only 3 attempts, 300s apart ---
|
# --- Requeue control: only 3 attempts, 300s apart ---
|
||||||
- name: "NB preflight | Publish delayed requeue (300s (10s)) if needed"
|
- name: "NB preflight | Publish delayed requeue (300s (10s)) if needed"
|
||||||
when:
|
when:
|
||||||
|
- not (sot_wrapper_mode | default(false))
|
||||||
- nb_script.stat.exists
|
- nb_script.stat.exists
|
||||||
- (nb_ip_changed | default(false)) or (
|
- (nb_ip_changed | default(false)) or (
|
||||||
(cloud_bad | default(false)) and
|
(cloud_bad | default(false)) and
|
||||||
@@ -243,6 +249,7 @@
|
|||||||
|
|
||||||
- name: "NB preflight | Log requeue publish response"
|
- name: "NB preflight | Log requeue publish response"
|
||||||
when:
|
when:
|
||||||
|
- not (sot_wrapper_mode | default(false))
|
||||||
- nb_script.stat.exists
|
- nb_script.stat.exists
|
||||||
- ((cloud_bad | default(false)) or (nb_ip_changed | default(false)))
|
- ((cloud_bad | default(false)) or (nb_ip_changed | default(false)))
|
||||||
- (requeue_attempt | int) < 3
|
- (requeue_attempt | int) < 3
|
||||||
@@ -255,6 +262,7 @@
|
|||||||
|
|
||||||
- name: "NB preflight | Stop host after requeue"
|
- name: "NB preflight | Stop host after requeue"
|
||||||
when:
|
when:
|
||||||
|
- not (sot_wrapper_mode | default(false))
|
||||||
- nb_script.stat.exists
|
- nb_script.stat.exists
|
||||||
- (
|
- (
|
||||||
(nb_ip_changed | default(false)) or
|
(nb_ip_changed | default(false)) or
|
||||||
@@ -275,4 +283,5 @@
|
|||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "IP-only | Stop after NetBox sync (no device scan)"
|
- name: "IP-only | Stop after NetBox sync (no device scan)"
|
||||||
|
when: not (sot_wrapper_mode | default(false))
|
||||||
meta: end_host
|
meta: end_host
|
||||||
|
|||||||
37
files/ansible-playbooks/sot-updater-wrapper.yml
Normal file
37
files/ansible-playbooks/sot-updater-wrapper.yml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# sot-updater-wrapper.yml
|
||||||
|
# Single nbplay invocation:
|
||||||
|
# Phase 1: Cloud -> NetBox sync (via sot-updater-iponly.yml in wrapper mode)
|
||||||
|
# Phase 2: Refresh ansible_host from nb_ip, reset_connection
|
||||||
|
# Phase 3: Run full sot-updater-current.yml
|
||||||
|
|
||||||
|
- import_playbook: sot-updater-iponly.yml
|
||||||
|
vars:
|
||||||
|
sot_wrapper_mode: true
|
||||||
|
|
||||||
|
|
||||||
|
- name: Phase 2 | Refresh in-memory target IP after iponly
|
||||||
|
hosts: all
|
||||||
|
gather_facts: no
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: "Wrapper | Stop host if nb_onedevice_update.py missing"
|
||||||
|
when: not (nb_script.stat.exists | default(false))
|
||||||
|
meta: end_host
|
||||||
|
|
||||||
|
- name: "Wrapper | Stop host if iponly did not return OK"
|
||||||
|
when: not (nb_ok | default(false))
|
||||||
|
meta: end_host
|
||||||
|
|
||||||
|
- name: "Wrapper | Stop host if returned IP is empty/NONE"
|
||||||
|
when: (nb_ip | default('') | trim) in ('', 'NONE', 'null')
|
||||||
|
meta: end_host
|
||||||
|
|
||||||
|
- name: "Wrapper | Override ansible_host to refreshed IP ({{ nb_ip }})"
|
||||||
|
set_fact:
|
||||||
|
ansible_host: "{{ nb_ip | trim }}"
|
||||||
|
|
||||||
|
- name: "Wrapper | Reset SSH connection context (ensure new ansible_host is used)"
|
||||||
|
meta: reset_connection
|
||||||
|
|
||||||
|
|
||||||
|
- import_playbook: sot-updater-current.yml
|
||||||
Reference in New Issue
Block a user