2017-06-15 18:36:18 +02:00
|
|
|
---
|
|
|
|
- name: Create user (SetUp)
|
|
|
|
vyos_user:
|
|
|
|
name: ansibletest1
|
|
|
|
password: test
|
|
|
|
state: present
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-06-29 13:51:13 +02:00
|
|
|
- '"set system login user" in result.commands[0]'
|
|
|
|
- '"authentication plaintext-password" in result.commands[0]'
|
2017-06-15 18:36:18 +02:00
|
|
|
|
|
|
|
- name: Collection of users (SetUp)
|
|
|
|
vyos_user:
|
|
|
|
users:
|
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
|
|
|
level: operator
|
|
|
|
state: present
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- 'result.commands == ["set system login user ansibletest2 level operator", "set system login user ansibletest3 level operator"]'
|
|
|
|
|
|
|
|
- name: Add user again (Idempotent)
|
|
|
|
vyos_user:
|
|
|
|
name: ansibletest1
|
|
|
|
password: test
|
|
|
|
state: present
|
2017-06-30 16:14:08 +02:00
|
|
|
update_password: on_create
|
2017-06-15 18:36:18 +02:00
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
- 'result.commands | length == 0'
|
|
|
|
|
|
|
|
- name: Add collection of users (Idempotent)
|
|
|
|
vyos_user:
|
|
|
|
users:
|
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
|
|
|
level: operator
|
|
|
|
state: present
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
- 'result.commands | length == 0'
|
|
|
|
|
|
|
|
- name: tearDown
|
|
|
|
vyos_user:
|
|
|
|
users:
|
|
|
|
- name: ansibletest1
|
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
|
|
|
state: absent
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- 'result.commands == ["delete system login user ansibletest1", "delete system login user ansibletest2", "delete system login user ansibletest3"]'
|