Install ncclient python package for junos switches on ansible 2.3+

This package is required on the ansible control host, and is used by the
ansible-connection process to access the switches via a persistent SSH
connection. It must be installed in the kayobe virtual environment.
This commit is contained in:
Mark Goddard 2017-10-11 16:23:30 +00:00
parent 8fc8937148
commit 1169ce111c

View File

@ -3,6 +3,8 @@
# not seem to be possible to use ansible_python_interpreter in combination with
# delegate_to. This should be investigated in future as modification of system
# packages via pip is not ideal.
# For ansible 2.2, Juniper specific python packages are required.
- name: Ensure python dependencies are installed
pip:
name: "{{ item }}"
@ -10,8 +12,20 @@
with_items:
- junos-eznc
- jxmlease
when: ansible_version | version_compare('2.3', 'lt')
become: True
# For ansible 2.3+, only the NETCONF client ncclient is required. This must be
# installed on the ansible control host where the ansible-connection subprocess
# is executed.
- name: Ensure python dependencies are installed
local_action:
module: pip
name: ncclient
virtualenv: "{{ lookup('env', 'VIRTUAL_ENV') | default(omit, true) }}"
when: ansible_version | version_compare('2.3', 'ge')
become: "{{ lookup('env', 'VIRTUAL_ENV') == None }}"
- name: Ensure Juniper switches are configured
junos_config:
provider: "{{ junos_switch_provider }}"