DEV Community

Roy
Roy

Posted on

ansible inventory plugin: host_list

之前能够正常使用的 ansible -i bk-poc-1, all -a date 命令现在不能正常执行,ansible提示

Unable to parse bk-poc-1, as an inventory source

加 -vvvvv 详细输出,可以看到

Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing bk-poc-1, as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing bk-poc-1, as it did not pass its verify_file() method
[WARNING]: Unable to parse bk-poc-1, as an inventory source

感觉是能够正确解析 "bk-poc-1," 的 inventory plugin 没有启用,查看官方文档,猜测应该是要启用 host_list

[inventory]
enable_plugins = host_list
Enter fullscreen mode Exit fullscreen mode

ansible-doc -t inventory -l 可以列出支持的 inventory plugin 及其作用,host_list 的作用是 "Parses a 'host list' string", 我启用了该 plugin 之后命令就能够正常执行了

Top comments (0)