kayobe/ansible/roles/junos-switch
Mark Goddard 1560bbc8fb Junos switch: update ncclient to 0.6.7+
ncclient 0.6.7 has been released and includes a fix [1] for the host key
checking issue that required us to pin to 0.6.2.

Restrict the package to <0.7.0 to avoid potential breakage from new
releases of ncclient.

[1] ead7b64092

Change-Id: Ia665cffb11253f58bbdce7ea9892766c36f7af40
Story: 2006378
Task: 38765
2020-02-28 09:49:42 +00:00
..
defaults Use local_action instead of delegate_to in switch config tasks 2017-10-12 10:49:13 +00:00
tasks Junos switch: update ncclient to 0.6.7+ 2020-02-28 09:49:42 +00:00
templates Remove unnecessary comma from JunOS switch config 2017-08-10 16:40:26 +00:00
README.md Updates to juniper switch configuration 2017-08-09 11:35:49 +00:00

JunOS Switch

This role configures Juniper switches using the junos Ansible modules. It provides a fairly minimal abstraction of the configuration interface provided by the junos modules, allowing for application of arbitrary switch configuration options.

Requirements

The switches should be configured to allow access to NETCONF via SSH.

Role Variables

junos_switch_delegate_to is the host on which to execute the junos Ansible modules.

junos_switch_provider is authentication provider information passed as the provider argument to the junos modules.

junos_switch_config_format is the format of configuration in junos_switch_config and junos_switch_interface_config. May be one of set, text or json.

junos_switch_config is a list of configuration lines to apply to the switch, and defaults to an empty list.

junos_switch_interface_config contains interface configuration. It is a dict mapping switch interface names to configuration dicts. Each dict may contain the following items:

  • description - a description to apply to the interface.
  • config - a list of per-interface configuration.

Dependencies

None

Example Playbook

The following playbook configures hosts in the junos-switches group. It assumes host variables for each switch holding the host, username and passwords. It applies global configuration for LLDP, and enables two 10G ethernet interfaces.

---
- name: Ensure Junos switches are configured
  hosts: junos-switches
  gather_facts: no
  roles:
    - role: junos-switch
      junos_switch_delegate_to: localhost
      junos_switch_provider:
        host: "{{ switch_host }}"
        username: "{{ switch_user }}"
        password: "{{ switch_password }}"
      junos_switch_config:
        - "protocols {"
        - "    lldp {"
        - "        interface all;"
        - "    }"
        - "}"
      junos_switch_interface_config:
        xe-1/1/1:
          description: server-1
          config:
            - "enable"
        xe-1/1/2:
          description: server-2
          config:
            - "enable"

Author Information