mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix vyos_user aggregate (#28317)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
403f6db53f
commit
2e211078ce
2 changed files with 15 additions and 7 deletions
|
@ -27,7 +27,7 @@ DOCUMENTATION = """
|
|||
---
|
||||
module: vyos_user
|
||||
version_added: "2.4"
|
||||
author: "Trishna Guha (@trishnag)"
|
||||
author: "Trishna Guha (@trishnaguha)"
|
||||
short_description: Manage the collection of local users on VyOS device
|
||||
description:
|
||||
- This module provides declarative management of the local usernames
|
||||
|
@ -231,18 +231,18 @@ def map_params_to_obj(module):
|
|||
if not module.params['name'] and module.params['purge']:
|
||||
return list()
|
||||
else:
|
||||
aggregate = [{'name': module.params['name']}]
|
||||
aggregatelist = [{'name': module.params['name']}]
|
||||
else:
|
||||
aggregate = list()
|
||||
aggregatelist = list()
|
||||
for item in aggregate:
|
||||
if not isinstance(item, dict):
|
||||
aggregate.append({'name': item})
|
||||
aggregatelist.append({'name': item})
|
||||
else:
|
||||
aggregate.append(item)
|
||||
aggregatelist.append(item)
|
||||
|
||||
objects = list()
|
||||
|
||||
for item in aggregate:
|
||||
for item in aggregatelist:
|
||||
get_value = partial(get_param_value, item=item, module=module)
|
||||
item['password'] = get_value('password')
|
||||
item['full_name'] = get_value('full_name')
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
---
|
||||
- name: Create user (SetUp)
|
||||
- name: Setup
|
||||
vyos_config:
|
||||
lines:
|
||||
- delete system login user ansibletest1
|
||||
- delete system login user ansibletest2
|
||||
- delete system login user ansibletest3
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Create user
|
||||
vyos_user:
|
||||
name: ansibletest1
|
||||
password: test
|
||||
|
|
Loading…
Reference in a new issue