跳到内容

only-builtins

此规则检查剧本是否仅使用来自`ansible.builtin`集合的操作。

这是一个可选规则。您必须在 Ansible-lint 配置中启用它,如下所示:

enable_list:
  - only-builtins

问题代码

---
- name: Example playbook
  hosts: all
  tasks:
    - name: Deploy a Helm chart for Prometheus
      kubernetes.core.helm: # <- Uses a non-builtin collection.
        name: test
        chart_ref: stable/prometheus
        release_namespace: monitoring
        create_namespace: true

正确代码

- name: Example playbook
  hosts: localhost
  tasks:
    - name: Run a shell command
      ansible.builtin.shell: echo This playbook uses actions from the builtin collection only.