Created
August 22, 2023 09:24
-
-
Save nmartins0611/4a680e32382c0f811c5240223247b291 to your computer and use it in GitHub Desktop.
Rulebook to filter chat messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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