Updating cisco 2514 ios mad friend dating his ex
Here we have created a block which correlated with a conditional when statement near the end of the playbook that tells ansible to proceed if the md5 value we gave matches the one computed by the switch.When it proceeds it then uses the ios_config module to remove any lines from the config that specify a boot image and then specifies a the new boot image.Not only can it be used to automate updating, it also backs up your configs and performs vulnerability checks.For those of you that already know what Ansible is and are looking for an example playbook that will help you automate updating your Cisco IOS equipment, you’re in the right place.- name: UPGRADE IOS IMAGE IF NOT COMPLIANT block: - name: COPY OVER IOS IMAGE ios_command: commands: - command: "copy tftp://xxx.xxx/ bootflash:" prompt: '' answer: "\r" vars: ansible_command_timeout: 1800Here we are running cli commands on the Cisco switch with Ansible to instruct the switch to connect to our TFTP server and pull down the IOS image we specified at the prompt.Ansible expects a prompt to confirm filename that should be saved on flash and answers by entering a carriage return “\r”.It then makes sure you want to Ansible to reload your switches for you.Hopefully this example is helpful and at least gets you pointed in the right direction for building your own play!
Here we have another block started which matches a conditional when toward the bottom that tells Ansible to proceed with reloading the device if we answered YES to the reboot question at the start of the play.Upgrade unsuccessful."Once Ansible sees the switch is back up, it pulls the ios_facts again and then compares the current running version to the version we gave in the beginning. If it doesn’t mtch Ansible displays a message telling you the upgrade was not successful.These when statements correlate with the blocks we configured earlier.Ansible anticipates a prompt to confirm intent to reload and answers with a carriage return.Here we tell Ansible to take a 60 second coffee break while the switch is reloading and then to begin poling the switch on port 22 to check for availability.
vars_prompt: - name: "compliant_ios_version" prompt: "What is the compliant IOS version?