Open mystery-rabbit opened 1 year ago
Version of module:
# /home/vagrant/meraki-as-code/ansible/roles/community/ansible_collections
Collection Version
------------ -------
cisco.meraki 2.15.0
Thank you for reporting this. I'm looking into it now.
Update. I've found the bug responsible for the first error. 1 line fix.
Regarding the second one, this one is harder. I think this error comes from dhcp_relay_server_ips
and dhcp_handling == "Run a DHCP server"
my (perceived) fact that they don't make a lot of sense to run together. If a network is running a DHCP server, it won't have to have a DHCP relay setup. Meraki isn't including dhcp_relay_server_ips
in the response so the diff comparison breaks and that's I think why it's not idempotent.
Do you have a use case where you need to specify both?
I agree with your analysis - i only stumbled across it trying to work out which attribute was throwing the original error. As for use case, no - nothing that couldn't be solved with some playbook logic - multiple calls and some "when x is defined" sort of thing.
I think I could also have it strip that from the payload since it's incompatible. Would that create any problems you could imagine?
No, it wouldn't, they are mutually exclusive in application. Is that compatible with the general approach and philosophy used in the rest of the project? are the modules in general acting as idempotent interfaces to the API - thus allowing me to malform a request should i wish to - or is including that sanity check part of the overall philosophy of the project? if it doesn't clash with your approach, that would make sense (and it should be set when dhcp_handling: "Relay DHCP to another server"
. )
I am facing the same issue with a much shorter declaration:
- name: Create VLAN
cisco.meraki.meraki_mx_vlan:
auth_key: "{{ meraki_authentication_key }}"
org_id: "{{ meraki_organisation_details.data.id }}"
net_id: "{{ meraki_network_details.data.id }}"
state: present
vlan_id: "{{ meraki_vlan_id }}"
name: "{{ meraki_vlan_name }}"
subnet: "192.168.10.1/24"
appliance_ip: "192.168.10.1"
dns_nameservers: google_dns
delegate_to: localhost
Here's what the module error contains:
The full traceback is: Traceback (most recent call last): File "
/.ansible/tmp/ansible-tmp-1686661857.357004-7648-85579569599896/AnsiballZ_meraki_mx_vlan.py", line 107, in _ansiballz_main() File " /.ansible/tmp/ansible-tmp-1686661857.357004-7648-85579569599896/AnsiballZ_meraki_mx_vlan.py", line 99, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File " /.ansible/tmp/ansible-tmp-1686661857.357004-7648-85579569599896/AnsiballZ_meraki_mx_vlan.py", line 47, in invoke_module runpy.run_module(mod_name='ansible_collections.cisco.meraki.plugins.modules.meraki_mx_vlan', init_globals=dict(_module_fqn='ansible_collections.cisco.meraki.plugins.modules.meraki_mx_vlan', _modlib_path=modlib_path), File " ", line 226, in run_module File " ", line 98, in _run_module_code File " ", line 88, in _run_code File "/tmp/ansible_cisco.meraki.meraki_mx_vlan_payload_ysykjkpk/ansible_cisco.meraki.meraki_mx_vlan_payload.zip/ansible_collections/cisco/meraki/plugins/modules/meraki_mx_vlan.py", line 585, in File "/tmp/ansible_cisco.meraki.meraki_mx_vlan_payload_ysykjkpk/ansible_cisco.meraki.meraki_mx_vlan_payload.zip/ansible_collections/cisco/meraki/plugins/modules/meraki_mx_vlan.py", line 562, in main File "/tmp/ansible_cisco.meraki.meraki_mx_vlan_payload_ysykjkpk/ansible_cisco.meraki.meraki_mx_vlan_payload.zip/ansible_collections/cisco/meraki/plugins/module_utils/network/meraki/meraki.py", line 205, in generate_diff TypeError: 'NoneType' object is not subscriptable
Found the cause of my problem: the subnet was 192.168.10.1/24
instead of 192.168.10.0/24
.
Meraki stores the CIDR using the first IP of the range (192.168.10.0/24
) so it was always highlighted as a change but there was nothing to apply when the Ansible module was trying to update the resource.
Thanks for the update. I'll take a look at the original bug still though.
Two parameters of meraki_mx_vlan command have idempotency issues:
specifying dhcp_handelling causes:
"HTTP error 400 - https://api.meraki.com/api/v1/networks/L_690176642894537554/appliance/vlans/1 - 'dhcpHandling' must be a string"
specifying dhcp_relay_server_ips as an empty string ( for the second time) causes:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: 'NoneType' object is not subscriptable
the following can be used to reproduce the first issue and with commenting, the second.:
example run: