Skip to content

Instantly share code, notes, and snippets.

@zhujinhe
zhujinhe / inventory2json.py
Created October 10, 2019 04:29 — forked from sivel/inventory2json.py
Ansible inventory to dynamic inventory JSON output, accepts all inventory input formats
import sys
import json
from ansible.parsing.dataloader import DataLoader
try:
from ansible.inventory.manager import InventoryManager
A24 = True
except ImportError:
from ansible.vars import VariableManager