ansible arping

Building on previous work for subnet scanning with ansible, I've written a small playbook to identify IP conflicts within a remote network using ansible. The inventory for the playbook can be any host that has the arping command, which includes any linux machine, or edgemax router. The beauty of the playbook is its simplicity and condensed output. Certainly this isn't an intended use for ansible, but being able to do this with ansible highlights its versatility.

- hosts: all
  gather_facts: no
    # net and ifc vars may be moved to inventory, or a prompt
    net :
    ifc : eth1
    # lazy regex for MAC addresses    
    mrx : '[0-9a-fA-F:]{17}'
    - name: Check for IP conflict
      command: arping -bc1 -I{{ ifc }} {{ net|ipaddr(item)|ipaddr('address') }}
      become: true
      register: r_arp
      changed_when: r_arp.stdout is not regex("Received [01] rep")
      failed_when: r_arp.stderr|default('')|length > 0
      loop_control: { label: "{{ net|ipaddr(item)|ipaddr('address') }} - {{ r_arp.stdout|regex_findall(mrx) }}" }
      with_sequence: end={{ net|ipaddr('size')|int -2 }}

See it in action: