I am using a variant of the example provided junipernetworks.junos.junos_l2_interfaces – L2 interfaces resource module
My playbook
- 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
Output from 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"}
So I updated the connection type to use netconf as recommend by the warning (and enabled netconf on the switch)
Updated Playbook:
- 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
Results in a Failed play but cryptic message
fatal: [10.70.44.76]: FAILED! => {"changed": false, "msg": "b'None'"}
So next I tried their persistent connection:
- 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
Results in a 3rd error!
fatal: [10.70.44.76]: FAILED! => {"changed": false, "msg": "Method not found"}
Anything else I am missing or can try?
I had solve the problem. Maybe you forget add variables "ansible_network_os: junipernetworks.junos.junos" when you use "connection: ansible.netcommon.netconf".