summaryrefslogtreecommitdiff
path: root/test/integration/targets/nxos_interface/tests/common/set_state_present.yaml
blob: 51f10ef58495ce70f002aca5783c2461ac072885 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
- debug: msg="START connection={{ ansible_connection }}/set_state_present.yaml"
- debug: msg="Using provider={{ connection.transport }}"
  when: ansible_connection == "local"

- 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
    provider: "{{ connection }}"
    state: present
    description: 'Configured by Ansible - Layer3'
  register: result

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

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

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

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