Ansible Lint无法检测独立Playbook任务的name[missing]规则问题
Ansible Lint
name[missing]规则的局限性 Ansible Lint的name[missing]规则存在检测范围限制:它不会对独立Playbook中未设置name的任务进行检查,但对角色内的同类问题可以正常捕获。
以下是测试用的独立Playbook示例:
--- - name: Update web servers hosts: webservers remote_user: root gather_facts: false tasks: - ansible.builtin.yum: name: httpd state: latest - ansible.builtin.template: src: /srv/httpd.j2 dest: /etc/httpd.conf
运行ansible-lint后,返回结果为:
Passed with production profile: 0 failure(s), 0 warning(s) on 1 files
示例中的两个任务均未设置name字段,按照name[missing]规则的设计逻辑应该被检测出来,但实际该规则仅在角色场景下生效,独立Playbook中的此类问题不会被识别。
内容的提问来源于stack exchange,提问作者Aseef Ahmed
相关产品推荐
相关产品推荐

