How can i insert value of variables using with items in conditional checks
name: system_ipaddress_mac_combinations present inside fact
debug:
msg : The system_ip-MAC combinations “{{ item }}” is present in teh fact
when: ‘{{ item }} in {{ csv_ip_mac_details }}’
with_items:
“{{ system_ip_mac_details }}”
TASK [system_ipaddress_mac_combinations present inside fact] ***********************************************************************************************************
[WARNING]: conditional statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{ item }} in {{ csv_ip_mac_details }}
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: