mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 20:13:59 -07:00
Fix junos_user purge option failures (#28867)
* Fix junos_user pruge option failures Fixes #25989 Add seperate handling for purge option which fetches configured users on remote device and delete the one not present in aggregate list. * Minor changes
This commit is contained in:
parent
effa5085ca
commit
a6af204cee
3 changed files with 66 additions and 16 deletions
|
@ -168,3 +168,26 @@
|
|||
- "result.changed == true"
|
||||
- "'<name>test_user1</name>' not in config.xml"
|
||||
- "'<name>test_user2</name>' not in config.xml"
|
||||
|
||||
- name: Create list of users
|
||||
junos_user:
|
||||
aggregate:
|
||||
- name: ansible
|
||||
- {name: test_user1, full_name: test_user2, role: operator}
|
||||
- {name: test_user2, full_name: test_user2, role: read-only}
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- name: Purge users except the users in aggregate
|
||||
junos_user:
|
||||
aggregate:
|
||||
- name: ansible
|
||||
purge: True
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- result.diff.prepared | search("\- *user test_user1")
|
||||
- result.diff.prepared | search("\- *user test_user2")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue