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
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
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:
[
{
"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