Skip to content

Dynamic inventory and questions #1093

Answered by Fizzadar
r3nor asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @r3nor - this is indeed possible using the ssh_hostname data key, ie:

# inventory.py
import requests

response = requests.get('https://api.something.com/v1/servers', headers=headers)
data = response.json()

servers = []
for server in data["items"]:
    servers.append((server["hostname"], {"ssh_hostname": server["ip"]}))

All the available SSH options are listed here.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Fizzadar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants