summaryrefslogtreecommitdiff
path: root/test/integration/targets/nxos_user/tests/common/basic.yaml
blob: 7152792d17a293b24bf98ce596da459e0cd5a4bf (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
- debug: msg="START connection={{ ansible_connection }} nxos_user basic test"
- debug: msg="Using provider={{ connection.transport }}"
  when: ansible_connection == "local"

- name: Remove old entries of user
  nxos_user:
    aggregate:
      - { name: ansibletest1 }
      - { name: ansibletest2 }
      - { name: ansibletest3 }
    state: absent

# Start tests
- name: Create user
  nxos_user:
    name: ansibletest1
    roles: network-operator
    state: present
  register: result

- assert:
    that:
      - 'result.changed == true'
      - '"username" in result.commands[0]'
      - '"role network-operator" in result.commands[1]'

- name: Collection of users
  nxos_user:
    aggregate:
      - { name: ansibletest2 }
      - { name: ansibletest3 }
    state: present
    roles: network-admin
  register: result

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

- name: tearDown
  nxos_user:
    aggregate:
      - { name: ansibletest1 }
      - { name: ansibletest2 }
      - { name: ansibletest3 }
    state: absent
  register: result

- assert:
    that:
      - 'result.changed == true'
      - '"no username" in result.commands[0]'

- debug: msg="END connection={{ ansible_connection }} nxos_user basic test"