2017-06-15 16:36:18 +00:00
|
|
|
---
|
2017-12-13 19:30:24 +00:00
|
|
|
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
2017-08-17 07:14:55 +00:00
|
|
|
- name: Setup
|
|
|
|
vyos_config:
|
|
|
|
lines:
|
|
|
|
- delete system login user ansibletest1
|
|
|
|
- delete system login user ansibletest2
|
|
|
|
- delete system login user ansibletest3
|
|
|
|
|
|
|
|
- name: Create user
|
2017-06-15 16:36:18 +00:00
|
|
|
vyos_user:
|
|
|
|
name: ansibletest1
|
2017-08-17 13:36:44 +00:00
|
|
|
configured_password: test
|
2017-06-15 16:36:18 +00:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
2017-06-29 11:51:13 +00:00
|
|
|
- '"set system login user" in result.commands[0]'
|
|
|
|
- '"authentication plaintext-password" in result.commands[0]'
|
2017-06-15 16:36:18 +00:00
|
|
|
|
|
|
|
- name: Collection of users (SetUp)
|
|
|
|
vyos_user:
|
2017-07-26 14:09:17 +00:00
|
|
|
aggregate:
|
2017-06-15 16:36:18 +00:00
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
|
|
|
level: operator
|
|
|
|
state: present
|
|
|
|
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
|
2017-08-17 13:36:44 +00:00
|
|
|
configured_password: test
|
2017-06-15 16:36:18 +00:00
|
|
|
state: present
|
2017-06-30 14:14:08 +00:00
|
|
|
update_password: on_create
|
2017-06-15 16:36:18 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
- 'result.commands | length == 0'
|
|
|
|
|
|
|
|
- name: Add collection of users (Idempotent)
|
|
|
|
vyos_user:
|
2017-07-26 14:09:17 +00:00
|
|
|
aggregate:
|
2017-06-15 16:36:18 +00:00
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
|
|
|
level: operator
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
- 'result.commands | length == 0'
|
|
|
|
|
|
|
|
- name: tearDown
|
|
|
|
vyos_user:
|
|
|
|
users:
|
|
|
|
- name: ansibletest1
|
|
|
|
- name: ansibletest2
|
|
|
|
- name: ansibletest3
|
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- 'result.commands == ["delete system login user ansibletest1", "delete system login user ansibletest2", "delete system login user ansibletest3"]'
|