CiscoDevNet/ansible-meraki

meraki_device module no longer query's Public IP's

mzendan99 opened this issue · 15 comments

Hi, haven't posted on here before, so not sure if I am doing this wrong.

I have been converting my playbooks on RHEL 7.9 & Ansible Version 2.9.27 to RHEL 9 , Ansible Version 2.14.0

  • Specifically, the "meraki_device" module no longer queries the public IP's from our appliance's uplink tab
  • I can pull wan1 & wan2 IP but these are not accurate for all devices when looking at the active public IP.
  • I am running the exact same meraki_device query in both playbooks, and they are pulling different API info.
  • I haven't been able to find any documentation about this, and I am not sure what is missing.

Any help/insight would be appreciated.

Hello!
Firstly, can you provide the example code when that incompatibility appeared.
Secondly, from the GUI have you got a the same active public IPs?

Thank you!

--
Marcin (y0rune)

What endpoint are you querying in Python to get the public IP address? The documentation isn't showing the one I use which is basically /networks/{net_id}/devices/{serial} but when I do a query it doesn't show any public IP info. Documentation (https://developer.cisco.com/meraki/api-v1/#!get-organization-devices-statuses) does show public IP is available on another endpoint though.

I'm curious why the Ansible version change is affecting things, if indeed it is. I'd like to work with you on this one more to resolve the issue.

Thank you.

Endpoint = /organizations/{org_id}/devices/statuses

That's what is happening. I'm not querying the statuses endpoint. Are you looking to query all devices in the organization or just a single one? I'm using /organizations/{org_id}/devices and swapping it with the statuses would likely be a breaking change. I could potentially add an option to get the statuses for this corner case until I do a major release and clean it up. I'll need to compare the output from mine to the statuses endpoint to see if it indeed would break backwards compatibility.

I use it to query all the devices in our org and then the rest of my playbook filters and extracts the public IP's to automate conditional access in azure for our meraki sites. I spent a significant amount of time trying to get it working with ansible modules, thinking I was doing something wrong, but this simple python request does the job for now.

Do you need anything from me to help test this?

At this moment, no. I'll need to do a stare and compare to see what's different between the old and new one. I may come back to you for something though, but nothing now. Thank you for asking.

Well that was quick. I won't be able to swap out the old endpoint with the new endpoint as the new one lacks geographical information. I'm going to think about how to implement it. My current thought is something like:

state: query
query_type: statuses

@kbreit Hi, It's been a little while, but I was curious if you implemented any changes for the endpoint?

kbreit commented

I haven't had an opportunity to delve into this yet. There's the possibility this is going to be significant effort so I will try to look soon and give an estimate.

No worries at all. My work around runs fine so there is no rush. Thanks for the follow up though.

kbreit commented

The way the endpoint works is very different. It needs the organization ID and uses parameters as filters whereas the current one uses the serial number. There are two approaches I could take:

  1. Add a new state value to the current module that adds a requirement for the organization information. In a way this is less than ideal because the endpoint does allow returning multiple devices, which the module doesn't support and the name meraki_device is singular so it's not intuitive.

  2. Create a new module focused on interfacing with this endpoint.

I'm leaning toward the second one but curious if you have a preference.