Skip to content

Commit dc63974

Browse files
committed
syncing instructions
1 parent a296b2d commit dc63974

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
# aap_controller_action
22
Github Action for Ansible Automation Platform - Automation controller
33

4+
## Table of Contents
5+
* [Example use-cases](#example-use-cases)
6+
* [Example of kicking off an automation job on Automation controller](#example-of-kicking-off-an-automation-job-on-automation-controller)
7+
* [Example of working with a Pull Request Methodology](#example-of-working-with-a-pull-request-methodology)
8+
* [Setting up your repo to work with this action](#setting-up-your-repo-to-work-with-this-action)
9+
* [I need help!](#i-need-help)
10+
## Example use-cases
411

12+
### Example of kicking off an automation job on Automation controller
513

6-
## Example of kicking off an automation job on Automation controller
14+
This would be equivalent of using an Automation controller webhook, but with the added benefit of the output from the job added to Github without additional playbooks needing to be written.
715

16+
Example of `.github/workflows/main.yml`
817
```
18+
on: push
19+
920
jobs:
1021
automation_controller_job:
1122
runs-on: ubuntu-latest
@@ -23,6 +34,44 @@ jobs:
2334
validate_certs: false
2435
```
2536

37+
### Example of working with a Pull Request Methodology
38+
39+
In this example we will only initiate the Github Action if there is a Pull Request on our Github repository. We need to have a `job_template` and `controller_project` specified. This will make sure that any in-bound pull requests (PRs) are tested rather than your existing project. This will allow people contributing to your Github repo to test their changes before you merge into your downstream repoistory.
40+
41+
Example of `.github/workflows/main.yml`
42+
43+
```
44+
on:
45+
pull_request_target:
46+
47+
jobs:
48+
automation_controller_job:
49+
runs-on: ubuntu-latest
50+
name: Kick off Automation controller job
51+
steps:
52+
- name: Load the ansible-cloud action
53+
id: controller_job
54+
uses: ansible-cloud/[email protected]
55+
with:
56+
controller_host: ${{ secrets.CONTROLLER_HOST }}
57+
controller_username: ${{ secrets.CONTROLLER_USERNAME }}
58+
controller_password: ${{ secrets.CONTROLLER_PASSWORD }}
59+
job_template: "test job"
60+
controller_project: "test project"
61+
extra_vars: "your_region=us-west-1"
62+
validate_certs: false
63+
env:
64+
pull_request_event: ${{ github.event.pull_request.number }}
65+
```
66+
67+
Workflow image:
68+
![workflow image of github pull request methodlogy](images/workflow_graphic.png)
69+
70+
For the Github Pull Request method to work, you need to make sure your specified **JOB TEMPLATE** has **Prompt on launch** set for both
71+
72+
* **Source Control Branch** (which requires the **PROJECT** to have Allow Branch Override checked)
73+
* **Variables**
74+
2675
## Setting up your repo to work with this action
2776

2877
You need to setup 3 (three) secrets:
@@ -34,3 +83,7 @@ You need to setup 3 (three) secrets:
3483
Example screenshot of Github Secrets
3584

3685
![picture of secrests](repo_secrets.png)
86+
87+
## I need help!
88+
89+
Open an [issue](https://github.com/ansible-cloud/aap_controller_action/issues) or join us on [Slack](https://join.slack.com/t/ansiblenetwork/shared_invite/zt-3zeqmhhx-zuID9uJqbbpZ2KdVeTwvzw)

images/workflow_graphic.png

86.2 KB
Loading

0 commit comments

Comments
 (0)