- name: Fetch the primary interface MAC address set_fact: mac_address: "{{ ansible_facts['default_ipv4']['macaddress'] }}" - name: Update variables.yml with the new MAC address delegate_to: localhost script: "/root/cherry-ipi/scripts/update_mac.py '{{ inventory_hostname }}'' '{{ mac_address }}'' '/root/cherry-ipi/variables.yml'"