404's are usually an incorrect API key. Does your key have write privs? And is it correct?
The other thing I see that I'm not sure (Ansible is still on my ToLearn list) is that the enabled: "true" should be a bool, not a string. Does Ansible properly convert that? Or should it read enabled: True instead?
Hi jdsila,
Thanks for reply.
Yes the API key is correct. I use it in postman and ansible other playbooks. this is one of the feature that does not come from the ansbile existing module.
Ansible did offer convert curl into uri module. I follow it and failed. 😞
Just tried it and get same error.
This time, I will post the whole error message.
I don't think it is the " but not sure... if any one know ansible may help?
Antien
fatal: [api.meraki.com]: FAILED! => {
"cache_control": "no-cache",
"changed": false,
"connection": "close",
"content": " ",
"content_type": "text/html; charset=utf-8",
"date": "Tue, 30 Jul 2019 19:45:37 GMT",
"elapsed": 0,
"invocation": {
"module_args": {
"attributes": null,
"auth_key": """my key}}",
"backup": null,
"body": {
"enabled": true
},
"body_format": "json",
"client_cert": null,
"client_key": null,
"content": null,
"creates": null,
"delimiter": null,
"dest": null,
"directory_mode": null,
"follow": false,
"follow_redirects": "safe",
"force": false,
"force_basic_auth": false,
"group": null,
"headers": {
"Content-Type": "application/json"
},
"http_agent": "ansible-httpget",
"method": "PUT",
"mode": null,
"net_id": "{{netid}}",
"org_id": 370177,
"owner": null,
"regexp": null,
"remote_src": null,
"removes": null,
"return_content": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"status_code": [
200
],
"timeout": 30,
"unix_socket": null,
"unsafe_writes": null,
"url": "https://api.meraki.com/api/v0/networks/{{netid}}/vlansEnabledState",
"url_password": null,
"url_username": null,
"use_proxy": true,
"validate_certs": true
}
},
"msg": "Status code was 404 and not [200]: HTTP Error 404: Not Found",
"redirected": false,
"server": "nginx",
"status": 404,
"transfer_encoding": "chunked",
"url": "https://api.meraki.com/api/v0/networks/{{netid}}/vlansEnabledState",
"vary": "Accept-Encoding",
"x_request_id": "4fa13837f83d4303926fa94ab4910bba",
"x_runtime": "0.025126",
"x_ua_compatible": "IE=Edge,chrome=1"
}
PLAY RECAP ************************************************************************************************************************************************************
api.meraki.com : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
The strange part is that there is a 200 respond on the http_agent session. so I am assuming the code is in dashboard and correct.
But after 30 time out the respond become 404.
I also disable the "validate_certs": true ti false. it still the same error.
Antien
When you make a request to https://api.meraki.com/ it actually redirects you to your "shard".
Make sure Ansible is set to follow HTTP 302 redirect messages.
@antienhe Just a safety precaution, please make sure to mask out sensitive information like API key or network IDs in the public forum for security purpose. This information is sensitive and can easily be misused.
Cheers!
Raj
Did you ever figure this out...i'm having the same problem. My api key works fine when using the meraki modules, but using the uri module i get the 404...