I am facing one more issue here, iam providing the conditional statemt in my playbook,,, but both are executing even if the conditions is true or false.
- name: System_ipaddress_mac_combinations present inside CSV_IP_MAC_DETAILS fact
debug:
msg : The system_ip-MAC combinations "{{ item }}" is present in the CSV_IP_MAC_DETAILS fact, If present it will be skipped and VALIDATION SUCCESS
when: item.find("csv_ip_mac_details") != -1
with_items:
- "{{ system_ip_mac_details }}"
- name: System_ipaddress_mac_combinations not present inside CSV_IP_MAC_DETAILS fact
debug:
msg : The system_ip-MAC combinations "{{ item }}" is not present in the CSV_IP_MAC_DETAILS fact So VALIDATION FAILED
when: item.find("csv_ip_mac_details") == -1
with_items:
- "{{ system_ip_mac_details }}"
TASK [Interface-Mac-Validation : System_ipaddress_mac_combinations present inside CSV_IP_MAC_DETAILS fact] **************************
skipping: [BVI15CA2]
TASK [Interface-Mac-Validation : System_ipaddress_mac_combinations not present inside CSV_IP_MAC_DETAILS fact] **********************
"msg": "The system_ip-MAC combinations \"
10.174.206.157: 02:15:0a:ae:ce:9d
10.145.19.4: 02:15:0a:91:13:04
172.16.7.52: 02:15:ac:10:07:34 \" is not present in the CSV_IP_MAC_DETAILS fact So VALIDATION FAILED"