Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meraki_device module no longer query's Public IP's #389

Open
mzendan99 opened this issue Dec 2, 2022 · 15 comments
Open

meraki_device module no longer query's Public IP's #389

mzendan99 opened this issue Dec 2, 2022 · 15 comments

Comments

@mzendan99
Copy link

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.

@y0rune
Copy link
Contributor

y0rune commented Dec 4, 2022

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)

@mzendan99
Copy link
Author

mzendan99 commented Dec 4, 2022 via email

@kbreit
Copy link
Collaborator

kbreit commented Dec 15, 2022

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.

@mzendan99
Copy link
Author

mzendan99 commented Dec 15, 2022

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

@kbreit
Copy link
Collaborator

kbreit commented Dec 15, 2022

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.

@mzendan99
Copy link
Author

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?

@kbreit
Copy link
Collaborator

kbreit commented Dec 16, 2022

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.

@kbreit
Copy link
Collaborator

kbreit commented Dec 16, 2022

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

@mzendan99
Copy link
Author

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

@kbreit
Copy link
Collaborator

kbreit commented Feb 16, 2023

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.

@mzendan99
Copy link
Author

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

@kbreit
Copy link
Collaborator

kbreit commented Feb 17, 2023

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.

@mzendan99
Copy link
Author

Hey @kbreit, its been a while since I have had time to get back into this. I appreciate you looking into it! I definitely want to clean up my playbook for this function and don't want to keep it hacked together with python. I am still dropping alot of devices across our meraki sites for some reason and can't find a correlation as to why some appliances aren't being picked up, when others are. As per your last reply, creating a new module for this endpoint would be awesome, but I am not sure how much effort that will take on your part. I will keep an eye on this thread and hope to hear back from your soon! Let me know if you need some screenshots from me, Thanks again.

@kbreit
Copy link
Collaborator

kbreit commented Aug 22, 2023

I am still open to creating a new module for this. I cannot commit to when it would be completed but the endpoint doesn't seem too challenging, especially since I have pagination built into the normal request function.

@kbreit
Copy link
Collaborator

kbreit commented Aug 29, 2023

@mzendan99 Please try the new meraki_device_statuses module in https://github.com/CiscoDevNet/ansible-meraki/tree/modules/device_statuses. It's not fully tested but it's a good start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants