Getting Started with AWX
Getting Started with AWX
This file is intended to be a quick guide to deploying and utilizing AWX resources. It is not a replacement for the AWX documentation available here, within the GitHub repos, or the official AWX documentation.
Overview
The CaC for Epic on Azure, or OHEMR, is managed through the ohemr-issue-tracker repository.
You must file an issue for AWX CaC actions and choose the appropriate resource type
(ex. job_template) and action (create or destroy). This will create a branch, a blank template file, and open a PR for you to complete. Once the PR
is merged, the GitHub Actions will take over and process the request sending the changes to the AWX API.
It needs to be pointed out that for almost everything that is created such as inventories or job templates, a second PR will be required for assigning access. It is not possible to combine this into a single request.
Workflow
This is the general order of operations because of what each item references (i.e. job template must be after inventory to reference the inventory). Not all items are required each time. A full list, in order, is available in the AWX CaC Module docs.
- Credential
- Inventory
- Job Template (references Inventory, Credential)
- Schedule (references Job Template)
- Role(s)
- This can be done one at a time after each item or in bulk at the end, however you will not be able to view or verify items or their IDs in the UI without a role assigned
In this example, we will make a job template but the process is nearly identical for most resources.
- Open the OHEMR-Issue-Tracker issues list
- Click
New Issue - Choose
Request Change to AWX CaC - Enter your own title for
Add a Titlebut do not modify the prefix (ex.[AWX_CaC_Request]: Adding Epic Role Job) - For
awx_cac_modulechoosejob_template - For
awx_req_typechoosecreate - Click
Create
At this point, your issue will trigger a GitHub Action that creates the branch and PR for you. The Action will update your issue with a link to the template file to modify on the correct branch, directly within GitHub if desired, and a link to the PR it opened on your behalf.
-
Click the link for the template file:
Direct Link to AWX CaC Request File -
Click Edit in GitHub, or clone the repository and use the branch you are provided
-
Paste the appropriate contents, below is a sample of a job template:
--- awx_job_template_list: - name: Job Title description: A description for the job job_type: run inventory: Inventory Name project: OHEMR Epic on Azure playbook: playbooks/epic-on-azure/pb_file_name.yml become_enabled: true execution_environment: awx-ee-omni-default credentials: - "Hashicorp Vault Token - eoavault" - "Other Credentials As Needed" ask_job_type_on_launch: trueEach file is a list of objects that are fed directly into the appropriate module from the Awx.Awx collection. For example,
awx_job_template_listis alistof objects that define job_template parameters. So, the parameters to use and which are required are called out by this documentation. The examples provided are not accurate since we are not calling the modules directly, so ignore any invocation metadata.Documentation example:
- name: Add start notification to Job Template job_template: name: "Ping" notification_templates_started: - Notification1 - Notification2Equivalent AWX example:
awx_job_template_list: - name: "Ping" notification_templates_started: - Notification1 - Notification2 -
Save and Commit the file
-
From the Issue, Open the Pull Request:
Click here to view and finalize your pull request- Do NOT change the title of the PR, doing so can break automation
-
Click
Ready for Reviewand go through the standard approval process to merge
Once an item is created, you need to assign the OHEMR team a role to be able to use it. This is the same process as above, so start with a new issue:
-
Open the OHEMR-Issue-Tracker issues list
-
Click
New Issue -
Choose
Request Change to AWX CaC -
Enter your own title for
Add a Titlebut do not modify the prefix (ex.[AWX_CaC_Request]: Adding Role to Job) -
For
awx_cac_modulechooserole -
For
awx_req_typechoosecreate -
Click
Create -
Click the link for the template file:
Direct Link to AWX CaC Request File -
Click Edit in GitHub, or clone the repository and use the branch you are provided
-
Paste the appropriate contents, below is a sample of a role:
--- awx_role_list: - teams: - Epic on Azure Infrastructure Operations Team role: Access job_templates: - This is a Job Title credentials: - This is a Credential NameIt is critical that the team
Epic on Azure Infrastructure Operations Teamis included. From there you can assign access to one or more items, even different types of items, in the same request. Using different keys such asinventories,instance_groups,projects,credentials, and more, you can specify the Name, ID, or URL for each resource. Names are easy, but if that resource changes it could be confusing. IDs can be gathered after a resource has been created.For more information, see the parameters available for the AWX.AWX.role module.
-
Save and Commit the file
-
From the Issue, Open the Pull Request:
Click here to view and finalize your pull request- Do NOT change the title of the PR, doing so can break automation
-
Click
Ready for Reviewand go through the standard approval process to merge