mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
iosxr modules aggregate check and other minor refactor (#28360)
* iosxr aggregate validation * vyos_user, junos_user minor changes * Aggregated documentation
This commit is contained in:
parent
ceef4f97ed
commit
9ab9945cf3
7 changed files with 150 additions and 71 deletions
|
@ -110,10 +110,12 @@ commands:
|
|||
- username ansible secret password group sysadmin
|
||||
- username admin secret admin
|
||||
"""
|
||||
|
||||
from functools import partial
|
||||
|
||||
from copy import deepcopy
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.network_common import remove_default_spec
|
||||
from ansible.module_utils.iosxr import get_config, load_config
|
||||
from ansible.module_utils.iosxr import iosxr_argument_spec, check_args
|
||||
|
||||
|
@ -243,19 +245,27 @@ def map_params_to_obj(module):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
argument_spec = dict(
|
||||
aggregate=dict(type='list', aliases=['users', 'collection']),
|
||||
element_spec = dict(
|
||||
name=dict(),
|
||||
|
||||
configured_password=dict(no_log=True),
|
||||
update_password=dict(default='always', choices=['on_create', 'always']),
|
||||
|
||||
group=dict(aliases=['role']),
|
||||
|
||||
purge=dict(type='bool', default=False),
|
||||
state=dict(default='present', choices=['present', 'absent'])
|
||||
)
|
||||
aggregate_spec = deepcopy(element_spec)
|
||||
aggregate_spec['name'] = dict(required=True)
|
||||
|
||||
# remove default in aggregate spec, to handle common arguments
|
||||
remove_default_spec(aggregate_spec)
|
||||
|
||||
argument_spec = dict(
|
||||
aggregate=dict(type='list', elements='dict', options=aggregate_spec, aliases=['users', 'collection']),
|
||||
purge=dict(type='bool', default=False)
|
||||
)
|
||||
|
||||
argument_spec.update(element_spec)
|
||||
argument_spec.update(iosxr_argument_spec)
|
||||
mutually_exclusive = [('name', 'aggregate')]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue