如何使用tower_group
或tower_host
模块将主机添加到组?
以下代码创建了一个主机和一个组,但它们彼此无关:
---
- hosts: localhost
connection: local
gather_facts: false
tasks:
- tower_inventory:
name: My Inventory
organization: Default
state: present
tower_config_file: "~/tower_cli.cfg"
- tower_host:
name: myhost
inventory: My Inventory
state: present
tower_config_file: "~/tower_cli.cfg"
- tower_group:
name: mygroup
inventory: My Inventory
state: present
tower_config_file: "~/tower_cli.cfg"
文档提到instance_filters
参数(“匹配主机的过滤表达式的逗号分隔列表。”),但没有提供任何使用示例。
添加instance_filters: myhost
到tower_group
任务没有效果。