The rulebook:
- name: Listen for events on a webhook
hosts: all
# Define our source for events
sources:
- ansible.eda.webhook:
host: 0.0.0.0
port: 5000
# Define the conditions we are looking for
rules:
- name: Demo rule
condition: event.meta["headers"]["Os"] == "linux"
action:
run_job_template:
name: Ansible-Windows-Template
organization: default
job_args:
extra_vars:
payload: "{{ event.payload.data }}"
The template playbook:
---
- name: Check Connectivity and Report on Windows Hosts
hosts: G_WIN
gather_facts: false
tasks:
- name: 00 - Display payload from the rulebook
ansible.builtin.debug:
msg: "Payload from the rulebook: {{ payload }}"
delegate_to: localhost
Error message:
{
"msg": "The task includes an option with an undefined variable. The error was: 'payload' is undefined. 'payload' is undefined\n\nThe error appears to be in '/runner/project/win.yml': line 6, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n tasks:\n - name: 00 - Display payload from the rulebook\n ^ here\n",
"_ansible_no_log": false
}
Reference document: variables
AAP Version: 2.5
Any help would be appreciated