deprecated-bare-vars¶ 此规则识别可能令人困惑的表达式,在这些表达式中,不清楚是要使用变量还是字符串,并要求进行澄清。 您应该使用完整的变量语法 ('{{{{ {0} }}}}'),或者尽可能将其转换为字符串列表。 有问题的代码¶ --- - ansible.builtin.debug: msg: "{{ item }}" with_items: foo # <-- deprecated-bare-vars 正确的代码¶ --- # if foo is not really a variable: - ansible.builtin.debug: msg: "{{ item }}" with_items: - foo # if foo is a variable: - ansible.builtin.debug: msg: "{{ item }}" with_items: "{{ foo }}"