Skip to content

Instantly share code, notes, and snippets.

@mhrivnak
Created March 25, 2025 19:55
Show Gist options
  • Select an option

  • Save mhrivnak/308fea6ed7c4a25d8fd3136f57eccd84 to your computer and use it in GitHub Desktop.

Select an option

Save mhrivnak/308fea6ed7c4a25d8fd3136f57eccd84 to your computer and use it in GitHub Desktop.
ansible-rulebook demo

Run ansible-rulebook, ensuring that rulebook.yml is in your current working directory.

$ podman run --rm -it -v ./:/data:z -e ANSIBLE_INVENTORY=localhost -p 5000:5000 quay.io/ansible/ansible-rulebook:latest ansible-rulebook --rulebook /data/rulebook.yml

POST some json that matches the condition:

curl -i -H 'Content-Type: application/json' -d "{\"message\": \"hello\"}" http://127.0.0.1:5000/
---
- name: Listen for events on a webhook
hosts: all
sources:
- ansible.eda.webhook:
host: 0.0.0.0
port: 5000
rules:
- name: Say Hello
condition: event.payload.message == "hello"
action:
debug:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment