Skip to content

Instantly share code, notes, and snippets.

@nmartins0611
Created August 22, 2023 09:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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
rules:
- name: Filter payload for hostnames
condition: event.payload.text is match("backup") ## backup is the trigger word set in mattermost
action:
run_playbook:
name: filter_regex.yml ## playbook to filter text payload - we want the hostnames
post_events: true
- name: Backup specified switch
condition: event.switch_devices is defined ## switch_devices is the fact set in the previous playbook
action:
run_playbook:
Name: switch_backup.yml ## Backup playbook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment