1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fixes #27336 - nxos_gir_profile_management issue while creating profile (#29151)

* Fixes #27336

* Correct documentation errors
This commit is contained in:
rahushen 2017-09-13 08:24:35 -04:00 committed by Trishna Guha
parent 7292dd20ed
commit f1cc5a928c

View file

@ -35,7 +35,6 @@ author:
- Gabriele Gerbino (@GGabriele) - Gabriele Gerbino (@GGabriele)
notes: notes:
- Tested against NXOSv 7.3.(0)D1(1) on VIRL - Tested against NXOSv 7.3.(0)D1(1) on VIRL
- This module is not idempotent when C(state=present).
- C(state=absent) removes the whole profile. - C(state=absent) removes the whole profile.
options: options:
commands: commands:
@ -70,7 +69,7 @@ options:
EXAMPLES = ''' EXAMPLES = '''
# Create a maintenance-mode profile # Create a maintenance-mode profile
- nxos_gir_profile: - nxos_gir_profile_management:
mode: maintenance mode: maintenance
commands: commands:
- router eigrp 11 - router eigrp 11
@ -79,7 +78,7 @@ EXAMPLES = '''
username: "{{ un }}" username: "{{ un }}"
password: "{{ pwd }}" password: "{{ pwd }}"
# Remove the maintenance-mode profile # Remove the maintenance-mode profile
- nxos_gir_profile: - nxos_gir_profile_management:
mode: maintenance mode: maintenance
state: absent state: absent
host: "{{ inventory_hostname }}" host: "{{ inventory_hostname }}"
@ -146,6 +145,9 @@ def get_existing(module):
def state_present(module, existing, commands): def state_present(module, existing, commands):
cmds = list() cmds = list()
if existing == commands:
# Idempotent case
return cmds
cmds.extend(commands) cmds.extend(commands)
if module.params['mode'] == 'maintenance': if module.params['mode'] == 'maintenance':
cmds.insert(0, 'configure maintenance profile maintenance-mode') cmds.insert(0, 'configure maintenance profile maintenance-mode')
@ -206,6 +208,7 @@ def main():
if module.check_mode: if module.check_mode:
module.exit_json(changed=True, commands=cmds) module.exit_json(changed=True, commands=cmds)
else: else:
if cmds:
load_config(module, cmds) load_config(module, cmds)
changed = True changed = True
end_state = invoke('get_existing', module) end_state = invoke('get_existing', module)