Ansible lint 报告 "Package installs should not use latest"

Ansible lint reports "Package installs should not use latest"

我终于开始使用 Ansible Lint 来确保我是最新的并且没有遗漏任何东西,我发现它报告了一个奇怪的问题 error/notice。当我使用 dnf 安装包时,我一直在使用 state: latest,因为它用于系统引导过程,我可能会在同一实例上多次 运行,尤其是在开发过程中。我总是希望在这种情况下安装最新的软件包,但 Ansible Lint 报告:

Package installs should not use latest

虽然我确信在我的用例中我没问题,但这仅仅是因为为了 "idempotency" 的利益,人们通常不希望这种行为吗?还是另有原因?如果他们总是要报告这个,那为什么还要提供 latest 状态选项?

ansible-lint 固执己见。您可能并不总是同意这些意见。还有人觉得这个错误来自 package 模块 should be removed.

无论如何,您都可以configure the linter忽略这个特定问题。在您的 playbook 目录中创建一个 .ansible-lint 文件,其中包含:

skip_list:
  - '403'