https://github.com/bugbiteme/aap-eda-demo
Ansible Demonstration of Event Driven Automation
https://github.com/bugbiteme/aap-eda-demo
Last synced: 5 months ago
JSON representation
Ansible Demonstration of Event Driven Automation
- Host: GitHub
- URL: https://github.com/bugbiteme/aap-eda-demo
- Owner: bugbiteme
- Created: 2023-04-11T18:30:51.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-14T17:14:49.000Z (about 3 years ago)
- Last Synced: 2025-01-31T12:36:19.588Z (over 1 year ago)
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# aap-eda-demo
Ansible Demonstration of Event Driven Automation
Prereqs:
`dnf --assumeyes install java-17-openjdk python3-pip`
`export JAVA_HOME=/usr/lib/jvm/java-17-openjdk`
`pip install ansible-rulebook`
`ansible-galaxy collection install ansible.eda`
## Webhook example
on terminal 1
`ansible-rulebook --rulebook webhook-example.yml -i inventory.yml --print-events`
on terminal 2
`curl -H 'Content-Type: application/json' -d "{\"message\": \"Ansible is alright\"}" 127.0.0.1:5000/endpoint`
look at results on terminal 1
on terminal 2
`curl -H 'Content-Type: application/json' -d "{\"message\": \"Ansible is super cool\"}" 127.0.0.1:5000/endpoint`
look at results on terminal 1
## Configuration Drift Example (webhook)
on terminal 1
`ansible-rulebook --rulebook webhook-example.yml -i inventory.yml --print-events`
on terminal 2 (to test)
`curl -H 'Content-Type: application/json' -d "{\"event_type\": \"drift-baseline-detected\"}" 127.0.0.1:5000/endpoint`
(or public URL from outside)
output should be:
```
{ 'meta': { 'endpoint': 'endpoint',
'headers': { 'Accept': '*/*',
'Content-Length': '41',
'Content-Type': 'application/json',
'Host': 'aap.leonlevy.net:5000',
'User-Agent': 'curl/7.87.0'}},
'payload': {'event_type': 'drift-baseline-detected'}}
PLAY [Remediation Playbook - Restore Baseline] *********************************
TASK [debug] *******************************************************************
ok: [localhost] => {
"msg": "Running Remediation Tasks for System!"
}
```
To test webhook with insights, set up basline config drift monitoring and set up webhook integrations
Using Red Hat Insights as a source of events for Event-Driven Ansible automation
https://www.ansible.com/blog/using-red-hat-insights-as-a-source-of-events-for-event-driven-ansible-automation
Introducing Red Hat Insights Drift Capability for Red Hat Enterprise Linux configuration troubleshooting
https://www.redhat.com/en/blog/introducing-red-hat-insights-drift-capability-red-hat-enterprise-linux-configuration-troubleshooting
Trigger event on managed RHEL system by issuing the following command on it:
`sudo insights-client`