Created
November 9, 2018 16:36
-
-
Save awilki01/db2ba39baee9b39dc7cd45c705a7188f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# This playbook is for: | |
# Upgrading from Cisco IOS XE 3.xE to Cisco IOS XE Denali 16.1.1, 16.1.2, or 16.1.3 in Insta | |
ll Mode | |
# https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst3650/software/release/16-1/rele | |
ase_notes/ol-16-1-3650.html | |
# Author: Adam Wilkins - 3/30/2018 | |
- name: Upgrade a Cisco IOS Device | |
hosts: c3650-upgrade-phase2 | |
tasks: | |
- name: Gathering Facts | |
ios_facts: | |
gather_subset: hardware | |
provider: "{{ creds_ssh }}" | |
timeout: 60 | |
tags: always | |
- name: Disable file task prompting | |
ios_config: | |
provider: "{{ creds_ssh }}" | |
lines: file prompt quiet | |
timeout: 60 | |
when: ansible_net_version != standard_version | |
tags: copy | |
- name: Copying image from ftp server to device flash | |
ios_command: | |
provider: "{{ creds_ssh }}" | |
commands: "copy ftp://{{ username }}:{{ password }}@{{ ftp_server_ip }}/{{ ftp_server_path }}/{{ image }} flash:\n\n" | |
timeout: 10800 | |
when: ansible_net_version != standard_version | |
tags: copy | |
- name: Get MD5 Hash from uploaded file | |
ios_command: | |
provider: "{{ creds_ssh }}" | |
commands: "verify /md5 {{ image }}" | |
timeout: 3600 | |
register: md5_check_output | |
#when: ansible_net_version != standard_version | |
tags: calc_hash | |
- name: set_fact | |
set_fact: | |
md5_calc_checksum: "{{ md5_check_output.stdout_lines[0][1] }}" | |
when: ansible_net_version != standard_version | |
tags: calc_hash | |
- name: MD5 Checksum Output | |
debug: | |
var: md5_calc_checksum | |
when: ansible_net_version != standard_version | |
tags: calc_hash | |
- name: Verify MD5 hash is correct | |
debug: | |
msg: Verify MD5 has is correct | |
failed_when: image_md5 not in md5_calc_checksum | |
when: ansible_net_version != standard_version | |
tags: calc_hash | |
- name: Clean up software | |
ios_command: | |
provider: "{{ creds_ssh }}" | |
commands: | |
- command: 'software clean' | |
prompt: '\[yes\/no\]:' | |
answer: 'yes' | |
timeout: 1800 | |
when: ansible_net_version != standard_version | |
tags: clean | |
- name: Install software to flash of switch(es) | |
ios_command: | |
provider: "{{ creds_ssh }}" | |
commands: "software install file flash:{{ image }} new force on-reboot" | |
timeout: 1800 | |
when: ansible_net_version != standard_version | |
tags: install_software | |
handlers: | |
- name: save config | |
ios_config: | |
provider: "{{ creds_ssh }}" | |
save_when: always |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment