diff --git a/files/ansible-playbooks/sot-updater.yml b/files/ansible-playbooks/sot-updater.yml index 86b1e28..13c5e03 100644 --- a/files/ansible-playbooks/sot-updater.yml +++ b/files/ansible-playbooks/sot-updater.yml @@ -445,7 +445,7 @@ delegate_to: localhost set_fact: ssid_strict_count: "{{ (ssid_strict_count_raw.stdout | default('0')) | trim | int }}" - ssid_strict_ok: "{{ ((ssid_strict_count_raw.stdout | default('0')) | trim | int) > 0 and (((ssid_strict_count_raw.stdout | default('0')) | trim | int) % 2 == 0) }}" + ssid_strict_ok: "{{ ssid_strict_count > 0 and (ssid_strict_count % 2 == 0) }}" - name: Dev1 | Count SSID lines (fallback exclude bssid/auto_ssid/SC/backhaul) when: not ssid_strict_ok | default(false) @@ -459,17 +459,21 @@ failed_when: false ignore_errors: true + - name: Dev1 | Normalize fallback SSID count + when: not ssid_strict_ok | default(false) + delegate_to: localhost + set_fact: + ssid_fallback_count: "{{ (ssid_fallback_count_raw.stdout | default('0')) | trim | int }}" + - name: Dev1 | Compute final SSID count delegate_to: localhost - when: - - (ssid_strict_count is defined) or (ssid_fallback_count is defined) set_fact: ssid_final_count: >- {{ - (strict_ok | default(false)) + (ssid_strict_ok | default(false)) | ternary( - (ssid_strict_count.stdout | default('0') | int) // 2, - (ssid_fallback_count.stdout | default('0') | int) // 2 + ssid_strict_count // 2, + (ssid_fallback_count | default(0)) // 2 ) }} @@ -477,11 +481,12 @@ delegate_to: localhost debug: msg: - - "strict_ok={{ strict_ok | default(false) }}" - - "strict_count={{ ssid_strict_count.stdout | default('n/a') }}" - - "fallback_count={{ ssid_fallback_count.stdout | default('n/a') }}" + - "ssid_strict_ok={{ ssid_strict_ok | default(false) }}" + - "ssid_strict_count={{ ssid_strict_count | default('n/a') }}" + - "ssid_fallback_count={{ ssid_fallback_count | default('n/a') }}" - "ssid_final_count={{ ssid_final_count | default('n/a') }}" + - name: Dev1 | Build multissidfix value delegate_to: localhost when: ssid_final_count is defined