diff --git a/files/ansible-playbooks/sot-updater-wrapper.yml b/files/ansible-playbooks/sot-updater-wrapper.yml index 3763fe0..ad580ec 100644 --- a/files/ansible-playbooks/sot-updater-wrapper.yml +++ b/files/ansible-playbooks/sot-updater-wrapper.yml @@ -14,17 +14,17 @@ 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 | Assert iponly succeeded" + ansible.builtin.assert: + that: + - nb_script is defined + - nb_script.stat.exists | default(false) + - nb_ok | default(false) + - (nb_ip | default('') | trim) not in ('', 'NONE', 'null') + fail_msg: >- + Wrapper stop: iponly did not produce a usable IP. + nb_ok={{ nb_ok | default('UNDEF') }}, + nb_ip='{{ nb_ip | default('UNDEF') }}' - name: "Wrapper | Override ansible_host to refreshed IP ({{ nb_ip }})" set_fact: @@ -33,5 +33,12 @@ - name: "Wrapper | Reset SSH connection context (ensure new ansible_host is used)" meta: reset_connection + - name: "Wrapper | Debug effective target" + debug: + msg: + - "Effective ansible_host={{ ansible_host }}" + - "nb_ip={{ nb_ip }}" + + - import_playbook: sot-updater.yml