---
- debug: msg="START {{ connection.transport }}/set_state_present.yaml"

- name: setup
  nxos_config:
    lines:
      - no interface Loopback1
    provider: "{{ connection }}"
  ignore_errors: yes # Fails if the interface is already absent

- name: set state=present
  nxos_interface:
    interface: Loopback1
    state: present
    description: 'Configured by Ansible - Layer3'
    provider: "{{ connection }}"
  register: result

- assert:
    that:
      - "result.changed == true"

- name: verify state=present
  nxos_interface:
    interface: Loopback1
    state: present
    description: 'Configured by Ansible - Layer3'
    provider: "{{ connection }}"
  register: result

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

- debug: msg="END {{ connection.transport }}/set_state_present.yaml"
