Comments (26)
Follow up on this one. I've spent some time on this last night and lunch today. Unfortunately, getting idempotency is more challenging than I thought. I'm working through it but taking longer than I hoped.
from ansible-meraki.
@richardjohnallsopp I just submitted a pull request (#204) for this. Can you give it a try and let me know what you think? Thanks.
from ansible-meraki.
from ansible-meraki.
What is the process for getting these and running them? If you could point me to some docs I'd appreciate it.
from ansible-meraki.
@richardjohnallsopp There are a couple of ways to go about this. The most straight forward and simple way is to download https://raw.githubusercontent.com/kbreit/ansible-meraki/module/meraki_alert/plugins/modules/meraki_alert.py and save it locally. You should have a directory called ~/.ansible/collections/ansible_collections/cisco/meraki
. Copy that file into ~/.ansible/collections/ansible_collections/cisco/meraki/plugins/modules
and you should be able to call it like any other module.
from ansible-meraki.
Awesome, thanks man I'm off this weekend so will try all this out and report back.
from ansible-meraki.
I get the following from this module:
(tanglewoodgames_meraki) flynn@NCL-WL-16612:~/tanglewoodgames_meraki$ ./configure_mx_home.sh --tags "configure_alerts"
PLAY [localhost] *****************************************************************************
TASK [Gathering Facts] ***********************************************************************
ok: [127.0.0.1]
TASK [configure alert settings] **************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'MerakiModule' object has no attribute 'convert_snake_to_camel'
fatal: [127.0.0.1 -> localhost]: FAILED! => changed=false
module_stderr: |-
Traceback (most recent call last):
File "/home/flynn/.ansible/tmp/ansible-tmp-1602436989.3608868-3174-24665290994372/AnsiballZ_meraki_alert.py", line 102, in <module>
_ansiballz_main()
File "/home/flynn/.ansible/tmp/ansible-tmp-1602436989.3608868-3174-24665290994372/AnsiballZ_meraki_alert.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/flynn/.ansible/tmp/ansible-tmp-1602436989.3608868-3174-24665290994372/AnsiballZ_meraki_alert.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.cisco.meraki.plugins.modules.meraki_alert', init_globals=None, run_name='__main__', alter_sys=True)
File "/usr/lib/python3.6/runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/tmp/ansible_meraki_alert_payload_x5wvf7o0/ansible_meraki_alert_payload.zip/ansible_collections/cisco/meraki/plugins/modules/meraki_alert.py", line 330, in <module>
File "/tmp/ansible_meraki_alert_payload_x5wvf7o0/ansible_meraki_alert_payload.zip/ansible_collections/cisco/meraki/plugins/modules/meraki_alert.py", line 305, in main
File "/tmp/ansible_meraki_alert_payload_x5wvf7o0/ansible_meraki_alert_payload.zip/ansible_collections/cisco/meraki/plugins/modules/meraki_alert.py", line 234, in construct_payload
AttributeError: 'MerakiModule' object has no attribute 'convert_snake_to_camel'
module_stdout: ''
msg: |-
MODULE FAILURE
See stdout/stderr for the exact error
rc: 1
from ansible-meraki.
Let me know if I'm doing something wrong?
from ansible-meraki.
I forgot about a change to the module utility I had to do. Please download https://raw.githubusercontent.com/CiscoDevNet/ansible-meraki/2c0bc3ba5d16de222d5c8d7a032a3b9fb4ef4ec9/plugins/module_utils/network/meraki/meraki.py and put it in the plugins/module_utils/network/meraki
directory. That should fix it.
from ansible-meraki.
Got it, will try and test today.
from ansible-meraki.
@richardjohnallsopp Were you able to test this module?
from ansible-meraki.
This one completes now, but do you have a list of names for the alert types? Also I have all_admins
set to false and it keeps adding it back in. It does add the emails I've listed, but using the gatewayDown
example doesn't set an alert.
from ansible-meraki.
# configure alerts for network
- name: configure alert settings
meraki_alert:
auth_key: "{{ auth_key }}"
org_name: "{{ org_name }}"
net_name: "{{ network_name }}"
state: present
default_destinations:
emails:
"{{ email_list }}"
all_admins: false
snmp: false
alerts:
- type: "gatewayDown"
enabled: yes
filters:
timeout: 60
alert_destinations:
emails:
"{{ email_list }}"
all_admins: false
snmp: false
delegate_to: localhost
tags:
- "configure_alerts"
from ansible-meraki.
I'm not sure how to translate these network alerts into alert type as I see no mention of gateway
from ansible-meraki.
Hopefully I catch you while you're still working and able to test. Here is a list of alerts, which I'll add to the documentation and enforce. What type of network are you using? MX? If so, it's possible it changes the available alerts based on network type.
- gatewayDown
- gatewayToRepeater
- repeaterDown
- rogueAp
- settingsChanged
- vpnConnectivityChange
- usageAlert
- weeklyPresence
from ansible-meraki.
Yeah it's an MX network, but it's not setting the alert type (maybe due to the type name) and it's adding all admins regardless of the bool setting.
from ansible-meraki.
Yeah so that list you gave kinda makes sense on the MR network:
Do you know where to get the MX ones I listed above? It's annoying that API docs don't have a list of all alerts :-(
from ansible-meraki.
I'm going to provide feedback to the API team to see if they can update documentation.
Regarding where to get it, I did a query (state: query
) and it will list the full data structure for the entire network. There you'll manually pull the types.
from ansible-meraki.
That worked to get the alert types and it works great, but it's still adding the all admins despite being set to false:
from ansible-meraki.
I'm looking into the all admins problem right now.
from ansible-meraki.
I'll post the alerts here for anyone else that might need them:
type: ampMalwareDetected
type: ampMalwareBlocked
type: applianceDown
type: failoverEvent
type: dhcpNoLeases
type: rogueDhcp
type: ipConflict
type: cellularUpDown
type: clientConnectivity
type: vrrp
type: vpnConnectivityChange
type: settingsChanged
type: usageAlert
from ansible-meraki.
Very helpful, thank you. I'm going to document these and probably enforce the values.
from ansible-meraki.
@richardjohnallsopp I think I fixed the bug. It's pushed to the branch so please download the file and use the latest version. I've renamed type
to alert_type
as well.
from ansible-meraki.
It's working great:
data
# list of alert type
alert_list:
- type: "ampMalwareDetected"
state: "yes"
- type: "ampMalwareBlocked"
state: "yes"
- type: "applianceDown"
state: "yes"
- type: "failoverEvent"
state: "yes"
- type: "dhcpNoLeases"
state: "no"
- type: "rogueDhcp"
state: "no"
- type: "ipConflict"
state: "no"
- type: "cellularUpDown"
state: "no"
- type: "clientConnectivity"
state: "no"
- type: "vrrp"
state: "no"
- type: "vpnConnectivityChange"
state: "no"
- type: "settingsChanged"
state: "no"
- type: "usageAlert"
state: "no"
task
# configure alerts for network
- name: configure alert settings
meraki_alert:
auth_key: "{{ auth_key }}"
org_name: "{{ org_name }}"
net_name: "{{ network_name }}"
state: present
default_destinations:
emails:
"{{ email_list }}"
all_admins: false
snmp: false
alerts:
- type: "{{ item.type }}"
enabled: "{{ item.state }}"
filters:
timeout: 60
alert_destinations:
emails:
"{{ email_list }}"
all_admins: false
snmp: false
delegate_to: localhost
with_items: "{{ alert_list }}"
tags:
- "configure_alert"
from ansible-meraki.
Yup you fixed it, it all works perfectly, thanks so much for the hard work on this man!!
from ansible-meraki.
@richardjohnallsopp 2.1.0 is released. Please redownload using ansible-galaxy
.
from ansible-meraki.
Related Issues (20)
- meraki_mx_vlan - add groupPolicyId HOT 1
- meraki_mr_radio_profile - Add support for AX setting
- SSL error while running playbooks HOT 1
- meraki_ms_switchport trunk with no native vlan HOT 1
- Issue with the ansible-lint HOT 2
- Update the workflow files HOT 1
- meraki_webhook query raises exception if no webhooks are defined HOT 13
- meraki_mx_vlan idempotency issues HOT 10
- meraki_network constraints around local and remote status pages is incorrect HOT 5
- meraki_webhook defaults shared_secret to null which clashes with API behaviour
- meraki_network query by ID returns empty data object HOT 1
- Consider using true/false for all booleans in docs HOT 3
- Problem with using loops within an organization's networks HOT 7
- meraki_static_route: Module does not query static routes HOT 4
- meraki_ms_switchport: link negotation has not all options
- Trying to get Kevin's attention HOT 2
- meraki_device module: Creating 404 errors HOT 11
- CI/DI for testing tests and endpoints HOT 1
- meraki_device making wrong API call HOT 7
- Future of the ansible-meraki on CiscoDevNet HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-meraki.