Our tools team setup Ansible Tower to use inventories contained in .ini files hosted on internal gitlab. I can not change this. I need to modify these files as the contents change in our environment (new builds, decommissions, etc)
I think I am SO close.
I can connect to gitlab with a private access token and get results, but I can not figure out what the path is to download files other than the README.md file like this
Invoke-RestMethod -Uri 'https://git.toolsite.com/api/v4/projects/13001/repository/files/README.md?ref=main' -Headers $Headers -Method GET
file_name : README.md file_path : README.md size : 139 encoding : base64
I can also recursively list the files:
Invoke-RestMethod -Uri 'https://git.toolsite.com/api/v4/projects/13001/repository/tree?ref=main&per_page=100&recursive=true' -Headers $Headers -Method GET
id : 4cf897a48c777c58b6cfdb1705d9e0fe28602a10
name : Windows_Non-Prod_Servers_Inventory.ini
type : blob
path : Inventory/Windows_Non-Prod_Servers_Inventory.ini
mode : 100644
id : 0ce79694fb4511b8a90379250ee829cd20b281f3
name : Windows_Prod_Servers_Inventory.ini
type : blob
path : Inventory/Windows_Prod_Servers_Inventory.ini
BUT I can not get the path right for Inventory/Windows_Prod_Servers_Inventory.ini
Invoke-RestMethod -Uri 'https://git.toolsite.com/api/v4/projects/13001/repository/files/Inventory/Windows_Non-Prod_Servers_Inventory.ini?ref=main' -Headers $Headers -Method GET
Invoke-RestMethod : {"error":"404 Not Found"}
Also, in a browser, the URL to that file is https://git.toolsite.com/bswh/bswh_windows/-/blob/main/Inventory/Windows_Non-Prod_Servers_Inventory.ini
I need a little help
thanks