2017-06-09 10:20:57 +02:00
|
|
|
---
|
2017-06-16 08:28:06 +02:00
|
|
|
- name: Create user (SetUp)
|
2017-06-09 10:20:57 +02:00
|
|
|
ios_user:
|
2017-06-16 08:28:06 +02:00
|
|
|
name: ansibletest1
|
2017-06-09 10:20:57 +02:00
|
|
|
privilege: 15
|
|
|
|
role: network-operator
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-06-16 08:28:06 +02:00
|
|
|
- 'result.commands == ["username ansibletest1 view network-operator", "username ansibletest1 privilege 15"]'
|
2017-06-09 10:20:57 +02:00
|
|
|
|
2017-06-16 08:28:06 +02:00
|
|
|
- name: Collection of users (SetUp)
|
2017-06-09 10:20:57 +02:00
|
|
|
ios_user:
|
2017-07-26 16:09:17 +02:00
|
|
|
aggregate:
|
2017-06-16 08:28:06 +02:00
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
2017-06-09 10:20:57 +02:00
|
|
|
authorize: yes
|
|
|
|
state: present
|
|
|
|
view: network-admin
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-06-16 08:28:06 +02:00
|
|
|
- 'result.commands == ["username ansibletest2 view network-admin", "username ansibletest3 view network-admin"]'
|
|
|
|
|
|
|
|
- name: Add user again (Idempotent)
|
|
|
|
ios_user:
|
|
|
|
name: ansibletest1
|
|
|
|
privilege: 15
|
|
|
|
role: network-operator
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
- 'result.commands | length == 0'
|
|
|
|
|
|
|
|
- name: Add collection of users again (Idempotent)
|
|
|
|
ios_user:
|
2017-07-26 16:09:17 +02:00
|
|
|
aggregate:
|
2017-06-16 08:28:06 +02:00
|
|
|
- name: anisbletest2
|
|
|
|
- name: ansibletest3
|
|
|
|
authorize: yes
|
|
|
|
state: present
|
|
|
|
view: network-admin
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
- 'result.commands | length == 0'
|
2017-06-09 10:20:57 +02:00
|
|
|
|
|
|
|
- name: tearDown
|
|
|
|
ios_user:
|
2017-07-26 16:09:17 +02:00
|
|
|
aggregate:
|
2017-06-16 08:28:06 +02:00
|
|
|
- name: ansibletest1
|
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
|
|
|
state: absent
|
2017-06-09 10:20:57 +02:00
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-06-16 08:28:06 +02:00
|
|
|
- 'result.commands == ["no username ansibletest1", "no username ansibletest2", "no username ansibletest3"]'
|