diff --git a/files/ansible-playbooks/sot-updater.yml b/files/ansible-playbooks/sot-updater.yml index c2e2657..7ba26c0 100644 --- a/files/ansible-playbooks/sot-updater.yml +++ b/files/ansible-playbooks/sot-updater.yml @@ -2660,7 +2660,7 @@ sshpass -f "{{ dev2_passfile_used }}" ssh {{ ssh_opts_common }} \ -o ConnectTimeout={{ ssh_timeout }} \ -p "$PORT" "{{ dev2_ssh_user }}@127.0.0.1" \ - "cat /tmp/config.json 2>/dev/null | grep -i block -A2 | grep enab | head -n1 || true" + "grep -i block -A2 /tmp/config.json 2>/dev/null | grep enab | head -n1 | grep -Eo 'true|false' | head -n1 || true" exit 0 fi @@ -2669,7 +2669,7 @@ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o ConnectTimeout=15 \ "{{ dev2_ssh_user }}@{{ lldp_dev2_ip }}" \ - "cat /tmp/config.json 2>/dev/null | grep -i block -A2 | grep enab | head -n1 || true" + "grep -i block -A2 /tmp/config.json 2>/dev/null | grep enab | head -n1 | grep -Eo 'true|false' | head -n1 || true" exit 0 fi @@ -2682,7 +2682,7 @@ -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \ -o ConnectTimeout={{ ssh_timeout }} \ '{{ dev2_ssh_user }}@\[${IP6}%{{ dev1_iface }}\]' \ - \"cat /tmp/config.json 2>/dev/null | grep -i block -A2 | grep enab | head -n1 || true\"" + \"grep -i block -A2 /tmp/config.json 2>/dev/null | grep enab | head -n1 | grep -Eo 'true|false' | head -n1 || true\"" exit 0 fi @@ -2700,13 +2700,11 @@ payredirect_raw_clean: "{{ dev2_payredirect_raw.stdout | default('') | trim | lower }}" set_fact: payredirect_value: >- - {%- if ('\"enabled\"' in payredirect_raw_clean) and ('true' in payredirect_raw_clean) -%} - true - {%- elif ('\"enabled\"' in payredirect_raw_clean) and ('false' in payredirect_raw_clean) -%} - false - {%- else -%} - na - {%- endif -%} + {{ + payredirect_raw_clean + if payredirect_raw_clean in ['true', 'false'] + else 'na' + }} changed_when: false - name: Dev2 | payredirect debug