I’m looking for some guidance on setting up webhook notification in AWX. Haven’t found any relevant documentation or examples online.
My requirement is to create an incident when a job is failed in AWX, there are two mandatory fields required by the incident creation API ie; short_description & assignment_group.
I tried passing this info as variables via http headers but gets an error (code 417). Also, dictionary is not allowed under http headers.
I did not find any other way to pass this info to the API, has anyone figured this out ?
Yes, you are spot on. So if I understand correctly, I should be able to send the payload using awx_webhook_payload variable. But where should I declare that variable ? Because in the webhook notification template, there’s only option to mention HTTP HEADERS.
I tried passing variables like below in the HTTP HEADERS section but it didn’t allow dictionary type input.
{
extra_vars: {
description: test,
group: abc
}
}
Does replacing extra_vars with awx_webhook_payload in the above declaration work ?
I’m not looking for AWX integration with Github webhook.
Just to be very clear, am trying to create a notification template of type Webhook. I need to send couple of inputs to the target URL but unable to do so. Looking for some guidance on how to accomplish this.
The error you are getting (must be of type str or bytes not <class ‘dict’>) is because that setting expects a dictionary of string: string. i.e.
{
“header1”: “value1”,
“header2”: “value2”
}
But you have:
{
“extra_vars”: {…}
}
So you are attempting to set the extra_vars header as a dict, not a string.
You may want to do something like:
{
“short_description”: “Test Incident”,
“assignment_group”: “A106”
}
That should give you two headers set to two different values. If you really need to merge the values into a single header, you will need to look at the docs for what you are calling into and see how they allow for that.
But when I pass it as two headers set to two different values also, it doesn’t take and throws error 417 which means the API didn’t get the payload what it was looking for.
So the question is how should we pass this payload in a way that the target API understands it correctly.
The -d is not a header, its a data sent via the HTTP POST body. Please look at the previously supplied documentation to see if there is a way to send post data with a webhook notification.
The mentioned documentation talks about the integration of github webhook with AWX and nothing about the webhook type notification template. Also, there is no field/option to send the data/payload to the webhook url in the GUI.
AFAIK, with the current setup there is no possibility to send data/payload to the webhook type notification url and this should be a feature to get added in future releases. Also, more meaningful error messages will be helpful.