Hello EDA Experts,
I’m new to Ansible. I recently installed AAP 2.5 for learning purpose. I was trying to create a simple rulebook which is triggered by a webhook from jfrog to run a template. I included a key value pair ( “os” = “linux” ) in the header when sending webhook, but having trouble for the condition in 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"
# Define the action we should take should the condition be met
action:
run_job_template:
name: Ansible-Windows-Template
organization: MyOrg
The condition statement in above code block doesn’t work. The only thing I can make the template to be triggered is these conditions:
condition: event.meta.headers is defined
or
condition: event.payload.event_type == 'deployed'
When I send the same webhook to webhook.site, I can see the key/value pair is in the header. Unfortunately, Jfrog only allows to customize headers, the payload is defined by jfrog and we cannot change it.
Can someone share some light on how to write the condition for matching a webhook header variable?
I wish there is a detailed document for reference, but I couldn’t find one.
Thanks