---
all:
hosts:
switch1:
ansible_ssh_host: 192.168.1.202
vars:
ansible_port: 22
ansible_connection: netconf
ansible_network_os: junos
ansible_python_interpreter: "/usr/local/opt/python/libexec/bin/python"
---
- hosts: all
connection: netconf
gather_facts: no
tasks:
- name: Enabling NETCONF if not enabled
vars:
ansible_connection: network_cli
junos_netconf:
netconf_port: 22
state: present
$ ansible-playbook -i inventory.yaml upgrade.yaml
PLAY [all] ****************************************************************************************************************************
TASK [Enabling NETCONF if not enabled] ************************************************************************************************
fatal: [switch1]: FAILED! => {"changed": false, "msg": "Connection type 'netconf' is not valid for 'junos_netconf' module. Please see https://docs.ansible.com/ansible/latest/network/user_guide/platform_junos.html"}
PLAY RECAP ****************************************************************************************************************************
switch1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
---
- hosts: all
connection: netconf
gather_facts: no
tasks:
- name: Enabling NETCONF if not enabled
connection: network_cli
junos_netconf:
netconf_port: 22
state: present
$ ansible-playbook -i inventory.yaml upgrade.yaml
PLAY [all] ****************************************************************************************************************************
TASK [Enabling NETCONF if not enabled] ************************************************************************************************
ok: [switch1]
PLAY RECAP ****************************************************************************************************************************
switch1 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0