0

In AWX, currently if you select inventory scripts > Custom scripts, you can only paste the code in the input box. Is there a way to pull the script from source control ?

sreenivas
  • 2,067
  • 1
  • 19
  • 29

1 Answers1

3

Here is the link to the documentation describing the process of checking in custom inventory scripts in source control. But, I didn't got it right in the first attempt.

So, here we go...

  • Add your custom inventory script to version control inside inventory folder. (eg: inventory/get_my_inventory.py in git_project)
  • Make sure you are giving executable permissions for this script before checking in to the repo otherwise AWX won't recognize the script and display in the list.

Now in AWX...

  • Click inventory > sources > new sources(+)
  • Select Create Source > Source > Sourced from a project.
  • Now in project select the project which has the custom inventory script file. (eg: git_project)
  • Now your custom script should show up in the inventory file drop down. (eg: inventory/get_my_inventory.py )

Well, its a simple process but I had to spend few hours to get it right. Hope that's of some help!

sreenivas
  • 2,067
  • 1
  • 19
  • 29