0

我正在使用提供的示例的变体junipernetworks.junos.junos_l2_interfaces – L2 接口资源模块

我的剧本

- name: Switch VLAN
  hosts: all
  connection: local
  tasks:
    - name: Replace VLAN
      junipernetworks.junos.junos_l2_interfaces:
        config:
          - name: xe-0/0/16
            access:
              vlan: 100
        state: replaced

Ansible 的输出:

[WARNING]: ['connection local support for this module is deprecated and will be removed in version 2.14, use connection ansible.netcommon.netconf']
fatal: [10.70.44.76]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (junipernetworks.junos.junos_l2_interfaces) module: provider Supported parameters include: config, running_config, state"}

所以我按照警告的建议更新了连接类型以使用 netconf(并在交换机上启用了 netconf)

更新的剧本:

- name: Switch VLAN
  hosts: all
  connection: ansible.netcommon.netconf
  tasks:
    - name: Replace VLAN
      junipernetworks.junos.junos_l2_interfaces:
        config:
          - name: xe-0/0/16
            access:
              vlan: 100
        state: replaced

导致播放失败但消息含糊

fatal: [10.70.44.76]: FAILED! => {"changed": false, "msg": "b'None'"}

所以接下来我尝试了他们的持久连接:

- name: Switch VLAN
  hosts: all
  connection: juniper.device.pyez
  tasks:
    - name: Replace VLAN
      junipernetworks.junos.junos_l2_interfaces:
        config:
          - name: xe-0/0/16
            access:
              vlan: 100
        state: replaced

导致第三个错误!

fatal: [10.70.44.76]: FAILED! => {"changed": false, "msg": "Method not found"}

还有什么我想念的或可以尝试的吗?

4

0 回答 0