sdn-sense / siterm

Apache License 2.0
3 stars 5 forks source link

Support Juniper OS (cli and netconf) #187

Open juztas opened 2 years ago

juztas commented 2 years ago

Notes:

JUNIPER!!!!!
inventory.yaml
junos:
  hosts:
    ex4550_s0:
      ansible_host: juztas@172.25.21.136
      ansible_user: juztas
      ansible_ssh_private_key_file: /opt/siterm/config/ssh-keys/id_rsa_sn3700

vi ~/.ssh/config
Host jumpbox
  User sense
  Hostname 132.249.2.46
  IdentityFile /opt/siterm/config/ssh-keys/id_rsa_sn3700

Host 172.25.21.136
  ProxyJump jumpbox
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: junipernetworks.junos.junos
hostname: ex4550_s0
----
inventory/group_vars/junos.yml
template_name: junos.j2
----
applyconfig.yaml
    - name: "Push config to Junos via cli"
      junipernetworks.junos.junos_config_command:
        src: /var/tmp/{{ inventory_hostname }}.conf
        provider:
          host: "{{ ansible_host }}"
          timeout: 300
      when: ansible_network_os is defined and ansible_network_os == 'junipernetworks.junos.junos'
getfacts.yaml
  - name: Gather legacy and resource facts
    junipernetworks.junos.junos_command:
      commands: show configuration | display json
    when: ansible_network_os is defined and ansible_network_os == 'junipernetworks.junos.junos'
maclldproute.yaml
  - name: "Get version, lldp, routes from Junos"
    junipernetworks.junos.junos_config_command:
      commands:
        - show chassis mac-addresses | display json
        - show lldp neighbors | display json
        - show route all | display json
        - show route all | display json
    when: ansible_network_os is defined and ansible_network_os == 'junipernetworks.junos.junos'
projects/templates/junos.j2

Also - Junos ansible module requires a patch; we should clone junos repo and patch it for our needs. (Patch is needed if Site does not want to implement junos netconf)

juztas commented 2 years ago

For CLI and Junos module - Cloned from official repo and changes done here: https://github.com/sdn-sense/junipernetworks.junos