Skip to content

Github ansible inventory

Import Playbooks and inventory from Github

Prerequisites

Setup credentials for your Github account

Login to github.com and go your profile on top and then go to settings

Scroll down to Developer settings then go to Personal access tokens. Click on tokens (classic) click Generate new token and then on Generate new token (classic) give it a name, select the expiration time, and give it repo access. Click save and then copy the token and keep it somewhere safe.

Setup Github credentials on AWX

Login to your AWX instance and go to credentials > add

Give it a name such as "github" and assign it to your organization. Select credential type and set it as "Source Control" then save it

Setup AWX to pull from Github

Navigate to projects > add. Give it a name and assign it to your organization. Under source control selct "git", put in your Github repo url under "Source Control URL", and select your Github credential that was setup earlier. I also like to select "update revision on launch. Click save

Setup inventory to pull from Github synced project

Navigate to Inventories > Add > Add inventory. Give it a name and assign it to your organization. Click save.

Navigate to your created inventory and click sources. Give it a name and assign it to your organization. Under source select "Sourced from a Project". Select the project and then provide the path to the inventory file for me it is "/Hosts/HomelabHosts/hosts.yml". Click save