38 lines
1.1 KiB
YAML
38 lines
1.1 KiB
YAML
# 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
|