从 Ansible Inventory 中排除特定虚拟机:VMware
Excluding specific VMs from Ansible Inventory: VMware
我在 Ansible Tower 中配置了一个源 "VMware vCenter" 的组。根据文档,可以将源变量指定为
Override variables found in vmware.ini and used by the inventory
update script. For a detailed description of these variables view
vmware.ini in the Ansible github repo.
GitHub 文件的摘录 -
Specify a prefix filter. Any VMs with names beginning with this string will not be returned.
prefix_filter = test_
就我而言,我至少有三个前缀需要排除。但是,当我尝试通过指定 prefix_filter 三次来做到这一点时,似乎只有第一个有效。如何排除以 Te 以外的名称开头的 VM?
我评论的答案:
我会尝试将较新的清单脚本 vmware_inventory.py 与 jinja host_filters 一起使用,或者将 vmware.py if vm.name.startswith( prefix_filter )
修补为适合您需要的内容。
我在 Ansible Tower 中配置了一个源 "VMware vCenter" 的组。根据文档,可以将源变量指定为
Override variables found in vmware.ini and used by the inventory update script. For a detailed description of these variables view vmware.ini in the Ansible github repo.
GitHub 文件的摘录 -
Specify a prefix filter. Any VMs with names beginning with this string will not be returned.
prefix_filter = test_
就我而言,我至少有三个前缀需要排除。但是,当我尝试通过指定 prefix_filter 三次来做到这一点时,似乎只有第一个有效。如何排除以 Te 以外的名称开头的 VM?
我评论的答案:
我会尝试将较新的清单脚本 vmware_inventory.py 与 jinja host_filters 一起使用,或者将 vmware.py if vm.name.startswith( prefix_filter )
修补为适合您需要的内容。