mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix nxos_igmp issues (#38496)
This commit is contained in:
parent
dabe5e6d07
commit
361437b042
2 changed files with 37 additions and 9 deletions
|
@ -132,10 +132,12 @@ def main():
|
|||
commands.append('no ip igmp enforce-router-alert')
|
||||
|
||||
elif state == 'present':
|
||||
if desired['flush_routes'] and not current['flush_routes']:
|
||||
commands.append('ip igmp flush-routes')
|
||||
if desired['enforce_rtr_alert'] and not current['enforce_rtr_alert']:
|
||||
commands.append('ip igmp enforce-router-alert')
|
||||
ldict = {'flush_routes': 'flush-routes', 'enforce_rtr_alert': 'enforce-router-alert'}
|
||||
for arg in ['flush_routes', 'enforce_rtr_alert']:
|
||||
if desired[arg] and not current[arg]:
|
||||
commands.append('ip igmp {0}'.format(ldict.get(arg)))
|
||||
elif current[arg] and not desired[arg]:
|
||||
commands.append('no ip igmp {0}'.format(ldict.get(arg)))
|
||||
|
||||
result = {'changed': False, 'updates': commands, 'warnings': warnings}
|
||||
|
||||
|
@ -145,7 +147,8 @@ def main():
|
|||
result['changed'] = True
|
||||
|
||||
if module.params['restart']:
|
||||
run_commands(module, 'restart igmp')
|
||||
cmd = {'command': 'restart igmp', 'output': 'text'}
|
||||
run_commands(module, cmd)
|
||||
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
- debug: msg="Using provider={{ connection.transport }}"
|
||||
when: ansible_connection == "local"
|
||||
|
||||
- set_fact: restart="true"
|
||||
when: platform is not match("N35")
|
||||
|
||||
- block:
|
||||
|
||||
- name: Configure igmp with non-default values
|
||||
|
@ -26,23 +29,45 @@
|
|||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: Configure igmp with default values
|
||||
- name: Configure igmp defaults
|
||||
nxos_igmp: &default
|
||||
flush_routes: false
|
||||
enforce_rtr_alert: false
|
||||
restart: "{{restart|default(omit)}}"
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence - Configure igmp with defaults"
|
||||
nxos_igmp: *default
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: Configure igmp non-defaults again
|
||||
nxos_igmp: *non-default
|
||||
register: result
|
||||
|
||||
- name: Configure igmp state as values
|
||||
nxos_igmp: &sdefault
|
||||
state: default
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence - Configure igmp with default values"
|
||||
nxos_igmp: *default
|
||||
- name: "Check Idempotence - Configure igmp with state default"
|
||||
nxos_igmp: *sdefault
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
always:
|
||||
- name: Configure igmp with default values
|
||||
nxos_igmp: *default
|
||||
nxos_igmp: *sdefault
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END connection={{ ansible_connection }} nxos_igmp sanity test"
|
||||
|
|
Loading…
Reference in a new issue