First commit
This commit is contained in:
commit
408d9b877a
|
@ -0,0 +1,3 @@
|
||||||
|
# ansible-inventory-tiramisu
|
||||||
|
|
||||||
|
Custom script to generate an inventory based on a tiramisu configuration.
|
|
@ -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'}]}))
|
Loading…
Reference in New Issue