Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Nexus 9300v running NX-OS 9.3.6 #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ checksum_to_platform_version:
platform: csr
build_version: 16.03.05
src_image_format: qcow2
f325cb1cfe8c29b673e76cc148ac290613e7cfd4:
platform: nxos
build_version: 9.3.6
src_image_format: qcow2

6 changes: 6 additions & 0 deletions tasks/nxos/9.3.6/bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Bootstrap VM
expect:
command: telnet localhost 8888
responses: "{{ expect_responses }}"
timeout: "{{ bootstrap_timeout }}"
10 changes: 10 additions & 0 deletions tasks/nxos/9.3.6/configure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- nxos_config:
src: "{{ image_config_path | default (platform + '/' + build_version + '/config.j2') }}"
save_when: always
vars:
ansible_user: admin
ansible_ssh_pass: admin
ansible_port: 8022
ansible_network_os: nxos
ansible_host_key_checking: false
21 changes: 21 additions & 0 deletions templates/nxos/9.3.6/config.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
hostname {{ hostname }}
ip domain-name {{ domain_name }}

interface mgmt0
ip address dhcp

{% if authentication_type == 'pubkey' %}
username admin password {{ admin_user_password }}
username {{ admin_user }} role network-admin
{% for key in admin_user_ssh_keys %}
username {{ admin_user }} sshkey ssh-rsa {{ key }}
{% endfor %}
{% for key in regular_user_ssh_keys %}
username {{ regular_user }} sshkey ssh-rsa {{ key }}
{% endfor %}
{% else %}
username {{ admin_user }} password {{ admin_user_password }} role network-admin
username {{ regular_user }} password {{ regular_user_password }}
{% endif %}

boot nxos bootflash:nxos.9.3.6.bin
10 changes: 10 additions & 0 deletions templates/nxos/9.3.6/inventory.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[nxos]
{{ hostname }}.{{ domain_name }}

[nxos:vars]
ansible_network_os=nxos
ansible_connection=local
ansible_host=localhost
ansible_port=8022
ansible_user={{ admin_user }}
ansible_ssh_pass={{ admin_user_password }}
3 changes: 3 additions & 0 deletions templates/nxos/9.3.6/qemu.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

/usr/bin/qemu-system-x86_64 -nographic -m 6144 -enable-kvm -serial telnet:localhost:8888,server,nowait -monitor telnet:localhost:8889,server,nowait -netdev user,id=net0,hostfwd=tcp::8022-:22 -device e1000,netdev=net0 -netdev user,id=net1 -device e1000,netdev=net1 -netdev user,id=net2 -device e1000,netdev=net2 -device ahci,id=ahci0,bus=pci.0 -drive file={{ image_name }}.qcow2,if=none,id=drive-sata-disk0,format=qcow2 -device ide-drive,bus=ahci0.0,drive=drive-sata-disk0,id=drive-sata-disk0,bootindex=0 -bios /usr/share/edk2/ovmf/OVMF_CODE.fd &
19 changes: 19 additions & 0 deletions vars/nxos/9.3.6/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
expect_responses:
'POAP DHCP Discover phase failed': ''
'Abort Power On Auto Provisioning.*: ': 'skip'
'login: ': admin
'Password: ': ''
'switch# ':
- config t
- "\x1d"
'switch\(config\)# ':
- username admin password admin role network-admin
- interface mgmt0
- exit
'switch\(config-if\)# ':
- ip address dhcp
- exit
'telnet>': quit

qemu_command: "/usr/bin/qemu-system-x86_64 -nographic -m 6144 -enable-kvm -serial telnet:localhost:8888,server,nowait -monitor telnet:localhost:8889,server,nowait -netdev user,id=net0,hostfwd=tcp::8022-:22 -device e1000,netdev=net0 -device ahci,id=ahci0,bus=pci.0 -drive file=cloned_image,if=none,id=drive-sata-disk0,format=qcow2 -device ide-drive,bus=ahci0.0,drive=drive-sata-disk0,id=drive-sata-disk0,bootindex=0 -bios /usr/share/edk2/ovmf/OVMF_CODE.fd"