def cinch_generic(playbook):
# Parse the command line arguments
parser = ArgumentParser(description='A wrapper around Cinch for the most '
'common use case')
# The inventory file that the user provides which will get passed along to
# Ansible for its consumption
parser.add_argument('inventory')
# All remaining arguments are passed through, untouched, to Ansible
parser.add_argument('args', nargs=REMAINDER)
args = parser.parse_args()
if len(args.inventory) > 0:
if args.inventory[0] == '/':
inventory = args.inventory
else:
inventory = path.join(getcwd(), args.inventory)
else:
raise Exception('Inventory path needs to be non-empty')
exit_code = call_ansible(inventory, playbook, args.args)
sys.exit(exit_code)
评论列表
文章目录