Skip to content

Instantly share code, notes, and snippets.

@nmartins0611
nmartins0611 / gist:3bae5c44a77eb7d1b850c1bd8d0d80c7
Created August 22, 2023 09:28
Rulebook listening for BGP Errors
##example
---
- name: Port State Event from switches
hosts: all
sources:
- ansible.eda.kafka:
host: broker
port: 9092
topic: network
@nmartins0611
nmartins0611 / gist:d23d5218ac9df898ffeefb00d6092639
Created August 22, 2023 09:27
Rulebook to monitor Status of BGP Events
##example
---
- name: Port State Event from switches
hosts: all
sources:
- ansible.eda.kafka:
host: broker
port: 9092
topic: network
@nmartins0611
nmartins0611 / gist:0d355fcff2b6bea316f14e7e06b28664
Created August 22, 2023 09:25
Basic Notification to MatterMost
## example
---
- name: Send notification message via Mattermost
community.general.mattermost:
url: ## Add URL
api_key: ## Add Token
attachments:
- text: "!!!!!! ALERT !!!!!!"
color: '#ff00dd'
@nmartins0611
nmartins0611 / gist:4a680e32382c0f811c5240223247b291
Created August 22, 2023 09:24
Rulebook to filter chat messages
## example
---
- name: Listen for events on a webhook
hosts: all
sources:
- ansible.eda.webhook:
host: 0.0.0.0
port: 5000
@nmartins0611
nmartins0611 / gist:6554b586bdbd780ff7dd9002ebf215f9
Created August 22, 2023 09:23
Regex Filter playbook to process patterns for hostnames
##example
---
- name: Regex Processing for hostnames
hosts: localhost
connection: local
gather_facts: false
vars:
eda_input: "{{ ansible_eda.event.payload.text }}" # access event payload
regex_pattern: '\b(\w+\.mydomain\.com)\b' # can supply via vars.yml
@nmartins0611
nmartins0611 / gist:b4e8824851b5007d3a8a1ccf398cac4b
Created August 22, 2023 09:22
Playbook to backup Arista Config
##example
playbook/switch_backup.yml
---
- name: Backup Switch
hosts: "{{ ansible_eda.event.switch_devices }}"
gather_facts: false
connection: httpapi
vars:
ansible_httpapi_port: 443
## example
---
- name: Listen for events on a webhook
hosts: all
sources:
- ansible.eda.webhook:
host: 0.0.0.0
port: 5000