forked from datacenter/Ansible-NXOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgrade_nxos_image.yml
53 lines (48 loc) · 1.48 KB
/
upgrade_nxos_image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
- name: Upgrade NXOS version
hosts: N9K-1
connection: local
gather_facts: no
tasks:
- name: Copy Image to the Switch
nxos_file_copy:
local_file: "/etc/scp_server/nxos.7.0.3.I4.5.bin"
username: "{{ un }}"
password: "{{ pwd }}"
host: "{{ inventory_hostname }}"
transport: nxapi
- block:
- name: Install OS
nxos_install_os:
system_image_file: nxos.7.0.3.I4.5.bin
host: "{{ inventory_hostname }}"
username: "{{ un }}"
password: "{{ pwd }}"
transport: cli
rescue:
- name: Wait for device to perform all checks
wait_for:
port: 22
state: stopped
timeout: 400
delay: 60
host: "{{ inventory_hostname }}"
- name: Wait for device to come back up
wait_for:
port: 22
state: started
timeout: 400
delay: 60
host: "{{ inventory_hostname }}"
- name: Check installed OS
nxos_command:
commands:
- show version
username: "{{ un }}"
password: "{{ pwd }}"
host: "{{ inventory_hostname }}"
transport: nxapi
register: output
- assert:
that:
- output['stdout'][0]['kickstart_ver_str'] == '7.0(3)I4(5)'