---
- debug: msg="START cli/set_lookup_source.yaml"

- name: setup
  iosxr_config:
    lines:
      - no domain lookup source-interface Loopback10
#      - vrf ansible
    match: none

- name: configure lookup_source
  iosxr_system:
    lookup_source: Loopback10
  register: result

- assert:
    that:
      - result.changed == true
      - "'domain lookup source-interface Loopback10' in result.commands"

- name: verify lookup_source
  iosxr_system:
    lookup_source: Loopback10
  register: result

- assert:
    that:
      - result.changed == false

#- name: change to vrf
#  iosxr_system:
#    lookup_source:
#      - interface: Loopback10
#        vrf: ansible
#  register: result
#
#- assert:
#    that:
#      - result.changed == true
#      - "'no ip domain lookup source-interface Management1' in result.commands"
#      - "'ip domain lookup vrf ansible source-interface Management1' in result.commands"
#      - result.commands|length == 2
#
#- name: verify change to vrf
#  iosxr_system:
#    lookup_source:
#      - interface: Management1
#        vrf: ansible
#  register: result
#
#- assert:
#    that:
#      - result.changed == false

- name: teardown
  iosxr_config:
    lines:
      - no domain lookup source-interface Loopback10
      - no vrf ansible
    match: none

- debug: msg="END cli/set_lookup_source.yaml"
