23 lines
725 B
Python
23 lines
725 B
Python
#!/usr/bin/env python3
|
|
|
|
"""
|
|
Custom script used to feed ansible with an inventory generated from a tiramisu configuration
|
|
"""
|
|
|
|
from json import dump
|
|
from tiramisu_cmdline_parser import TiramisuCmdlineParser
|
|
from tiramisu import Config, OptionDescription, BooleanOption, DomainnameOption
|
|
|
|
listOption = BooleanOption('list', 'List servers managed by tiramisu', properties=('mandatory', ))
|
|
hostOption = DomainnameOption('host', 'Get all variables about a specific instance')
|
|
root = OptionDescription('inventory', 'Inventory builder', [listOption, hostOption])
|
|
|
|
inventory_config = Config(root)
|
|
|
|
parser = TiramisuCmdlineParser(inventory_config)
|
|
|
|
parser.parse_args()
|
|
|
|
if parser.list:
|
|
print(dump({'all':[{'test': 'MyServer'}]}))
|