本文整理汇总了Python中ansible.runner.Runner.get_inject_vars方法的典型用法代码示例。如果您正苦于以下问题:Python Runner.get_inject_vars方法的具体用法?Python Runner.get_inject_vars怎么用?Python Runner.get_inject_vars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ansible.runner.Runner
的用法示例。
在下文中一共展示了Runner.get_inject_vars方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_template
# 需要导入模块: from ansible.runner import Runner [as 别名]
# 或者: from ansible.runner.Runner import get_inject_vars [as 别名]
def show_template(host, path, gather_facts=True,
inventory_file=None, password_file=None):
inventory = get_inventory(inventory_file, password_file)
setup_cache = get_gathered_facts(host, inventory) if gather_facts else {}
# Show the template
runner = Runner(
inventory=inventory,
setup_cache=setup_cache,
)
host_vars = runner.get_inject_vars(host)
print template_from_file('.', path, host_vars)
示例2: show_vars
# 需要导入模块: from ansible.runner import Runner [as 别名]
# 或者: from ansible.runner.Runner import get_inject_vars [as 别名]
def show_vars(host, inventory_file=None, password_file=None):
inventory = get_inventory(inventory_file, password_file)
Runner.get_inject_vars = get_inject_vars
runner = Runner(inventory=inventory)
runner.get_inject_vars(host)