1

我正在一个 Ansible 项目中创建一个,我想确定项目剧本使用的requirements.yml所有需要​​安装的模块。似乎是适合这项工作的工具,但它列出了所有本地可用的模块,而不仅仅是目录中实际使用的模块。不考虑任何需要但未安装的内容。ansible-galaxyansible-doc --list --playbook-dir foo fooansible-galaxy list

有没有办法做到这一点,我最终不会为sed|awk|grep我想要的信息编写一个 shell 脚本?


到目前为止,我能想到的最好的方法是ansible-playbook --syntax-check每个剧本。这将引发错误,例如

ERROR! the role 'foo' was not found ...
ERROR! couldn't resolve module/action 'bar'. This often indicates a misspelling, missing collection, or incorrect module path.

但这并不理想,因为一旦发生任何错误它就会退出。我必须修复每一个并再次运行语法检查。

4

0 回答 0