diff --git a/ansible/roles/junos-switch/tasks/main.yml b/ansible/roles/junos-switch/tasks/main.yml index 7506f89c4..8f5ce0153 100644 --- a/ansible/roles/junos-switch/tasks/main.yml +++ b/ansible/roles/junos-switch/tasks/main.yml @@ -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 }}"