inbound webhook support

11 views
Skip to first unread message

Dave Cottlehuber

unread,
Oct 16, 2017, 6:44:25 AM10/16/17
to ansible...@googlegroups.com
hi folks

I'd like to trigger ansible from a webhook - a github commit in this
case. How have other people done this?

A+
Dave

Dave Cottlehuber

unread,
Oct 16, 2017, 12:32:04 PM10/16/17
to ansible...@googlegroups.com
I'm still interested to hear what others do, but here's a working
solution from today's hacking using haproxy (for TLS termination and
some access control restrictions) and exposing
https://github.com/adnanh/webhook and the following webhook.json file:

```json
[
{
"id": "ansible",
"execute-command": "make daemons",
"command-working-directory": "/home/deploy/src/ansible",
"pass-arguments-to-command":
[
{
"source": "payload",
"name": "head_commit.id"
},
{
"source": "payload",
"name": "pusher.name"
},
{
"source": "payload",
"name": "pusher.email"
}
],
"trigger-rule":
{
"and":
[
{
"match":
{
"type": "payload-hash-sha1",
"secret": "{{ config.webhook.secret }}",
"parameter":
{
"source": "header",
"name": "X-Hub-Signature"
}
}
}
]
}
}
]
```

In my case, the "entry point" for all ansible playbooks is handled in a
Makefile. webhook provides either command-line parameter passing, or
environment variables.

A+
Dave
Reply all
Reply to author
Forward
0 new messages