本文整理汇总了Python中ansible.runner.Runner.parse_hosts方法的典型用法代码示例。如果您正苦于以下问题:Python Runner.parse_hosts方法的具体用法?Python Runner.parse_hosts怎么用?Python Runner.parse_hosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ansible.runner.Runner
的用法示例。
在下文中一共展示了Runner.parse_hosts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_class_override
# 需要导入模块: from ansible.runner import Runner [as 别名]
# 或者: from ansible.runner.Runner import parse_hosts [as 别名]
def test_class_override(self):
override_hosts = ["thor", "odin"]
hosts, groups = Runner.parse_hosts(self.inventory_file, override_hosts)
assert hosts == override_hosts
assert groups == {"ungrouped": override_hosts}
示例2: test_class_method
# 需要导入模块: from ansible.runner import Runner [as 别名]
# 或者: from ansible.runner.Runner import parse_hosts [as 别名]
def test_class_method(self):
hosts, groups = Runner.parse_hosts(self.inventory_file)
expected_hosts = ["jupiter", "saturn", "zeus", "hera", "poseidon", "thor", "odin", "loki"]
assert hosts == expected_hosts
expected_groups = {
"ungrouped": ["jupiter", "saturn"],
"greek": ["zeus", "hera", "poseidon"],
"norse": ["thor", "odin", "loki"],
}
assert groups == expected_groups