2

I am trying to use the Ansible Tower REST API to configure a Tower instance to pull the inventory from EC2. However, the REST API only has documented the ways to GET the Inventory Source, and I can't seem to find a way to create one. Is this possible with the current API, and if so, how can I do this?

Derek Brown
  • 4,232
  • 4
  • 27
  • 44

2 Answers2

2

I ultimately found an answer to this problem- you cannot create a new inventory source by the current API. Instead, it is created for you when you create an inventory group. To edit this inventory source, you can find its ID (in the related fields for the inventory group you created), and make a PUT request to edit.

The easiest approach I found to testing was to use the Web Interface and my Browser's Network Inspector, as I could see what API calls were being made as I performed particular tasks.

Derek Brown
  • 4,232
  • 4
  • 27
  • 44
0

Just do a post to api/v2/inventories/{id}/inventory_sources/ For reference, GET another source to know what to fill in POST data.

adiga
  • 34,372
  • 9
  • 61
  • 83