First commit

This commit is contained in:
Benjamin Bohard 2019-11-07 16:24:57 +01:00
commit 408d9b877a
2 changed files with 25 additions and 0 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# ansible-inventory-tiramisu
Custom script to generate an inventory based on a tiramisu configuration.

22
tiramisu.py Normal file
View File

@ -0,0 +1,22 @@
#!/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'}]}))