复杂性¶
此规则旨在警告那些似乎过于复杂的 Ansible 内容,建议进行重构以提高可读性和可维护性。
complexity[tasks]¶
如果一个文件中的任务总数超过 100,则会触发 complexity[tasks]
。如果遇到这种情况,您应该考虑使用 ansible.builtin.include_tasks
将您的任务拆分为更小的文件。
complexity[nesting]¶
当一个块包含太多任务时,会出现 complexity[nesting]
,默认情况下,该数字为 20,但可以通过在配置文件中定义 max_block_depth
值来更改。
Replace nested block with an include_tasks to make code easier to maintain. Maximum block depth allowed is ...