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

Iosxr 7.4.2 support #27

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
8 changes: 8 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ regular_user: ansible
# Allows the role to identify a platform from the SHA1 of a provided image
# which allows us to load the platform & version specific bootstrap & configuration
checksum_to_platform_version:
cafcdcb60fe9e1974c4596b0409dbb3fc9344c23:
platform: iosxr
src_image_format: ova
build_version: 7.0.2
b7e7f4b6c2a5a42c562acd9b1fb626d9ea1a2850:
platform: iosxr
src_image_format: ova
build_version: 7.4.2
89e0fc9dd45f5682ed222f36f1ea952b049b1888:
platform: nxos
build_version: 7.0.3.I7.3
Expand Down
7 changes: 7 additions & 0 deletions tasks/iosxr/7.0.2/bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Bootstrap VM
expect:
echo: yes
command: telnet localhost 8888
responses: "{{ expect_responses }}"
timeout: "{{ bootstrap_timeout }}"
26 changes: 26 additions & 0 deletions tasks/iosxr/7.0.2/configure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---

- iosxr_config:
lines:
- hostname {{ hostname }}
- domain name {{ domain_name }}
- username zuul password {{ regular_user_password }}
- copy:
content: "{{ ssh_key_public_content }}"
dest: "{{playbook_dir}}/id_rsa.pub"

- shell: "cut -d' ' -f2 {{playbook_dir}}/id_rsa.pub | base64 -d >| id_rsa.pub.b64"

- expect:
command: "sftp -P 8022 admin@localhost:/disk0:/"
responses:
'Are you sure you want to continue connecting': 'yes'
'Password:': admin123
'sftp>':
- put id_rsa.pub.b64
- exit
timeout: 100

- iosxr_command:
commands:
- crypto key import authentication rsa username zuul disk0:/id_rsa.pub.b64
7 changes: 7 additions & 0 deletions tasks/iosxr/7.4.2/bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Bootstrap VM
expect:
echo: yes
command: telnet localhost 8888
responses: "{{ expect_responses }}"
timeout: "{{ bootstrap_timeout }}"
26 changes: 26 additions & 0 deletions tasks/iosxr/7.4.2/configure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---

- iosxr_config:
lines:
- hostname {{ hostname }}
- domain name {{ domain_name }}
- username zuul password {{ regular_user_password }}
- copy:
content: "{{ ssh_key_public_content }}"
dest: "{{playbook_dir}}/id_rsa.pub"

- shell: "cut -d' ' -f2 {{playbook_dir}}/id_rsa.pub | base64 -d >| id_rsa.pub.b64"

- expect:
command: "sftp -P 8022 admin@localhost:/disk0:/"
responses:
'Are you sure you want to continue connecting': 'yes'
'Password:': admin123
'sftp>':
- put id_rsa.pub.b64
- exit
timeout: 100

- iosxr_command:
commands:
- crypto key import authentication rsa username zuul disk0:/id_rsa.pub.b64
10 changes: 10 additions & 0 deletions templates/iosxr/7.0.2/inventory.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[iosxr]
{{ hostname }}.{{ domain_name }}

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


/usr/bin/qemu-system-x86_64 -nographic -m 8192 -enable-kvm -serial telnet:localhost:8888,server,nowait -serial telnet:localhost:8890,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=cloned_image,if=ide, &
10 changes: 10 additions & 0 deletions templates/iosxr/7.4.2/inventory.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[iosxr]
{{ hostname }}.{{ domain_name }}

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


/usr/bin/qemu-system-x86_64 -nographic -m 8192 -enable-kvm -serial telnet:localhost:8888,server,nowait -serial telnet:localhost:8890,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=cloned_image,if=ide, &
37 changes: 37 additions & 0 deletions vars/iosxr/7.0.2/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
ansible_user: admin
ansible_ssh_pass: admin123
ansible_port: 8022
ansible_network_os: iosxr
ansible_host_key_checking: false

expect_responses:
'Press any key to continue': ''
'Press RETURN to get started.': ''
'Enter root-system username:': admin
'Enter secret:': admin123
'Enter secret again:': admin123
'Username:': admin
'Password:': admin123
'RP/0/RP0/CPU0:ios#':
- config
- exit
- "\x1d"
'RP/0/RP0/CPU0:ios\(config\)#':
- interface MgmtEth0/RP0/CPU0/0
- router static address-family ipv4 unicast 0.0.0.0/0 MgmtEth0/RP0/CPU0/0 10.0.2.2
- ssh server v2
- ssh server vrf default
- commit
- exit
'RP/0/RP0/CPU0:ios\(config-if\)#':
- ipv4 address dhcp
- no shutdown
- tpa address-family ipv4 update-source MgmtEth0/RP0/CPU0/0
'telnet>': quit

bootstrap_timeout: 600

qemu_command: "/usr/bin/qemu-system-x86_64 -nographic -m 8192 -enable-kvm -serial telnet:localhost:8888,server,nowait -serial telnet:localhost:8890,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=cloned_image,if=ide,"

ssh_key_public_content: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDI3XA0A84nUpCr9mfkrDjBdoNFtYMXqXMm2+WsGrOJUA2ESodUDDfTKmsA/xEygdCnj8JfSC3SYhc0uKHVe0RdG20mzntUqD50kB0STFeOHh3ee7FXmMxcLqLlyY9pJkn1V5WOi/D1Lbz8MwRUVBfqufryavwHla/9CPuAtPcut8mTUB0+Rapnv8W3n4dA6PqHNW1tylJUXj6P4trJPnFrdfMaIxc21tfd/QrMM4h90phW3zNILE0qF9UHpQxP0zew/LcD9rc+IhnbgC3DeCQDyiqJOsJRDo58RuwWmQHCF0SfiFQJ4qwrc6TFSJqSdi2aRY0S/vRMbXkD+6Hg2KWQyz6Z6EpY7RARletqJwNnzuuhXr2HSCj5QALe+0U/aUEX+dnydYBX6Nqa+0Rz/qV5aUk4YP1C2/dBCAdbYXPotBT6QBfekE428mJV8Mr7G/M7kwZ8v9WjytyJ8/FYNuekYDWonk6QTwDgQhMTiQI3Yxnu3ID63BL959lfUIv96bsifVI6/D36KTAdFi/dl7Omn5MZ9A5JXA7l+yEJKf4pcPTpQcPbjGSKyaPu0uffEjV9CTr3+VMwzq1uenxGDQ9cT/ud4pEEjwU/ihr6yttouTCvDu9ydrflHljUXxf+X00NW7HkrHnvS43AGnxQzi9g2lTOC9yDlDGbQjmnVjec7w== zuul-executor"
37 changes: 37 additions & 0 deletions vars/iosxr/7.4.2/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
ansible_user: admin
ansible_ssh_pass: admin123
ansible_port: 8022
ansible_network_os: iosxr
ansible_host_key_checking: false

expect_responses:
'Press any key to continue': ''
'Press RETURN to get started.': ''
'Enter root-system username:': admin
'Enter secret:': admin123
'Enter secret again:': admin123
'Username:': admin
'Password:': admin123
'RP/0/RP0/CPU0:ios#':
- config
- exit
- "\x1d"
'RP/0/RP0/CPU0:ios\(config\)#':
- interface MgmtEth0/RP0/CPU0/0
- router static address-family ipv4 unicast 0.0.0.0/0 MgmtEth0/RP0/CPU0/0 10.0.2.2
- ssh server v2
- ssh server vrf default
- commit
- exit
'RP/0/RP0/CPU0:ios\(config-if\)#':
- ipv4 address dhcp
- no shutdown
- tpa address-family ipv4 update-source MgmtEth0/RP0/CPU0/0
'telnet>': quit

bootstrap_timeout: 600

qemu_command: "/usr/bin/qemu-system-x86_64 -nographic -m 8192 -enable-kvm -serial telnet:localhost:8888,server,nowait -serial telnet:localhost:8890,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=cloned_image,if=ide,"

ssh_key_public_content: "AAAAB3NzaC1yc2EAAAADAQABAAABAQDgOp/WpwK0HBfgJoYDXo+yZbLqkNrbkbtk3p6MxJumQlXxXhKWY0uJXbrecjhJG6Ydv/6SzKQeoVWSPJUkZ0xD1l7KCPN+iNJyRQGwiyIi/Vd7JNt0pn+dblmPA5GzAwEMcT+49OlK0I1p1JwpSa0CFgNH8zSZOqCaH8yUiKtbc0UtCdQehSIcHvz573E2IbeDMG1omijf6fAT67tEAzEbsasCN/bSmXDraAQ+XIPPsFoifCQaSOL3SsyjG0awNfTotiBW68DqzR29KYwMQntM1ACVWPMda2rVTUFmV51ono/Ux2vRiV8zMCQAzZdy9gkF+3bDnK7VeY2rccp7EaVj root@managesf"