ansible-meraki
ansible-meraki copied to clipboard
Query organisation rf profiles without `net_id`
I was wondering if there is a way we could make the meraki_mr_rf_profile
module have the ability to query and add the RF profiles at an org level without the requirement of net_id
. The use case is we have a massive AP deployment where each site in our wireless org has a network, but we use a single template to configure all the devices. RF profiles live in the template, but the way the module works right now we would have to manage a profile per network.
I want to be able to add a profile to a template instead of managing at the network level and then I can assign where needed in each network.
I'm constrained by what the API will allow me to do. Browsing the API I'm not seeing any option for applying an RF Profile to an organization instead of a network. Are you familiar with an endpoint that attaches it to the organization?
No I couldn't see a way to do it via the API but thought I'd ask, I assume you can add profiles to templates either?
You should be able to apply it to templates. Instead of specifying the network ID specify the template ID in net_id
.
Ok cool I'll give that a shot and get back to you ASAP. So using that logic could I use template ID in net_id
when I query for profiles? If that works I can then pull the data from the portal and have ansible build be the variable files I want to use for updating and creating.
Seems like query doesn't like the template ID instead of net_id
task:
# use module to pull device settings
- name: Query template RF profiles
cisco.meraki.meraki_mr_rf_profile:
auth_key: "{{ auth_key }}"
org_name: "{{ org_name }}"
net_id: "N_573083052582924368" # global template ID
state: query
delegate_to: localhost
register: inventory_rf_profiles
tags:
- "debug_p"
output:
TASK [Query template RF profiles] *****************************************************************************************************
fatal: [localhost -> localhost]: FAILED! => changed=false
msg: No network found with the name N_573083052582924368
response: OK (unknown bytes)
status: 200
UPDATE: You said use net_id
not net_name
testing again.
So that just hangs for some reason
TASK [Query template RF profiles] *******************************************************************************************************
[WARNING]: Internal server error 500, retry 1
[WARNING]: Internal server error 500, retry 2
[WARNING]: Internal server error 500, retry 3
[WARNING]: Internal server error 500, retry 4
[WARNING]: Internal server error 500, retry 5
[WARNING]: Internal server error 500, retry 6
[WARNING]: Internal server error 500, retry 7
[WARNING]: Internal server error 500, retry 8
[WARNING]: Internal server error 500, retry 9
[WARNING]: Internal server error 500, retry 10
[WARNING]: Internal server error 500, retry 11
fatal: [localhost -> localhost]: FAILED! => changed=false
msg: Rate limit retries failed for https://api.meraki.com/api/v1/networks/N_573083052582924368/wireless/rfProfiles
response: OK (unknown bytes)
status: 500
@richardjohnallsopp When you say template, you mean a configuration template, yes? If so, can you confirm that's indeed your configuration template ID? In my experience configuration template ID's begin with L_
and you're showing N_
. That may not solve the problem, but it's the first thing jumping out to me.
@kbreit when I query any wireless network where the template is applied I get the same ID
TASK [debug] ****************************************************************************************************************************************
ok: [localhost] =>
msg:
changed: false
data:
config_template_id: N_573083052582924368
enrollment_string: null
id: N_573083052582922385
is_bound_to_config_template: true
name: Wireless -
notes: ''
organization_id: '470324'
product_types:
- wireless
tags:
-
time_zone: Greenwich
url:
failed: false
response: OK (unknown bytes)
status: 200
@kbreit when I query any wireless network where the template is applied I get the same ID
TASK [debug] **************************************************************************************************************************************** ok: [localhost] => msg: changed: false data: config_template_id: N_573083052582924368 enrollment_string: null id: N_573083052582922385 is_bound_to_config_template: true name: Wireless - notes: '' organization_id: '470324' product_types: - wireless tags: - time_zone: Greenwich url: failed: false response: OK (unknown bytes) status: 200
What module is this? Looks more like meraki_network
than RF profiles.
The above is me querying the meraki_network
to show that the template ID I'm using in meraki_mr_rf_profile
is correct. For some reason when I use the net_id
as the template ID it hangs for a while and then errors out.
TASK [Query template RF profiles] *******************************************************************************************************
[WARNING]: Internal server error 500, retry 1
[WARNING]: Internal server error 500, retry 2
[WARNING]: Internal server error 500, retry 3
[WARNING]: Internal server error 500, retry 4
[WARNING]: Internal server error 500, retry 5
[WARNING]: Internal server error 500, retry 6
[WARNING]: Internal server error 500, retry 7
[WARNING]: Internal server error 500, retry 8
[WARNING]: Internal server error 500, retry 9
[WARNING]: Internal server error 500, retry 10
[WARNING]: Internal server error 500, retry 11
fatal: [localhost -> localhost]: FAILED! => changed=false
msg: Rate limit retries failed for https://api.meraki.com/api/v1/networks/N_573083052582924368/wireless/rfProfiles
response: OK (unknown bytes)
status: 500
I created a new integration test and the query to meraki_network
seems to be working. Are we approaching this task the same way?
- name: Query network created by template
meraki_network:
auth_key: '{{ auth_key }}'
state: query
org_name: '{{test_org_name}}'
net_name: TemplateClone
delegate_to: localhost
register: query_cloned_network
TASK [meraki_network : debug] *******************************************************************************
ok: [localhost] => {
"query_cloned_network": {
"changed": false,
"data": {
"config_template_id": "L_6248744482971111111",
"enrollment_string": null,
"id": "L_6248744482972222",
"is_bound_to_config_template": true,
"name": "TemplateClone",
"notes": null,
"organization_id": "33333333",
"product_types": [
"appliance",
"switch",
"wireless"
],
"tags": [],
"time_zone": "America/Los_Angeles",
"url": "https://n110.meraki.com/TemplateClone-sw/n/Vcf3IcUb/manage/usage/list"
},
<snip>
}
}
Yeah my code is the same as is the output, what doesn't work is using that template ID to query the RF profiles attached to the template. I'd like to see this working in your lab. One issue I can think about is that our Meraki wireless template was manually build 5 years ago so that might explain the weird ID.
Do you have Postman or any tool like that? If you know how to, please try the query there. What does it respond with? If it has a 500 error and gives no details you should be able to work with Meraki support on the problem.