- 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: ../scripts/update_mac.py "{{ inventory_hostname }}" "{{ mac_address }}" "../variables.yml"