def get_args():
"""
Return Command Line Arguments.
:return: ArgumentParser instance
"""
parser = ArgumentParser(description="vSphere Ansible Inventory.",
epilog="Example:\n"
"./vsphere_inventory.py -l\n"
"./vsphere_inventory.py -s <vSphere.hostname>"
"-u <vSphere_username> -p <vSphere_password> -l\n")
parser.add_argument('-s', '--hostname', help='vSphere vCenter FQDN')
parser.add_argument('-u', '--username', help='vSphere username')
parser.add_argument('-p', '--password', help='vSphere password')
parser.add_argument('-P', '--port', help='vSphere Port')
parser.add_argument('-c', '--no_cert_check', help='Dont check vSphere certificate', action='store_true')
parser.add_argument('-g', '--guest', help='Print a single guest')
parser.add_argument('-x', '--host', help='Print a single guest')
parser.add_argument('-r', '--reload-cache', help='Reload cache', action='store_true')
parser.add_argument('-l', '--list', help='List all VMs', action='store_true')
return parser.parse_args()
vsphere_inventory.py 文件源码
python
阅读 34
收藏 0
点赞 0
评论 0
评论列表
文章目录