跳到内容

deprecated-module

此规则识别 playbook 中已弃用的模块。您应该避免使用已弃用的模块,因为它们不再维护,这可能会带来安全风险。此外,当一个模块被弃用时,它会暂时可用,并计划在未来删除。

有关已弃用模块的替换和删除日期的信息,请参阅 Ansible 模块索引

有问题的代码

---
- name: Example playbook
  hosts: localhost
  tasks:
    - name: Configure VLAN ID
      ansible.netcommon.net_vlan: # <- Uses a deprecated module.
        vlan_id: 20

正确的代码

---
- name: Example playbook
  hosts: localhost
  tasks:
    - name: Configure VLAN ID
      dellemc.enterprise_sonic.sonic_vlans: # <- Uses a platform specific module.
        config:
          - vlan_id: 20