Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger an Ansible Tower Job template from Github branch commit?

How can I trigger a job in Ansible Tower using its API on a Github branch commit?

I could use a Github webhook but when triggered by a push it occurs regardless of branch. I'm wondering if the webhook payload could provide info but I m not sure how to utilize it within the job. Am I on the right track or is there a better approach?

Thanks.

like image 909
Carson Cole Avatar asked Aug 17 '17 06:08

Carson Cole


1 Answers

You could use a pipeline using GitHub actions and conditionals. For example:

on:
  # Trigger the workflow on push or pull request,
  # but only for the main branch
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

Taken from here.

like image 158
Rafael de Bem Avatar answered Oct 03 '22 20:10

Rafael de Bem