Thursday, September 12, 2019

Ansible upgrade code - "msg": "bad character range"

Hey,

Maybe I should put this in the Ansible subreddit, but since it's directly related to network, I figured I'd ask here. So, I'm using Ansible to push upgrades to IOS devices that have older code. Currently I have a script I am attaching, every time I run it Ansible returns this: fatal: [test-wan]: FAILED! => {"changed": false, "msg": "bad character range"}

I'm struggling to find this on Google or any docs. Anyone have any ideas why my YAML is failing? Or what this error really means?

The script (I've removed the majority of the playbook, it's failing at the second task "UPGRADE IOS IMAGE IF NOT COMPLIANT"):

---

- name: UPGRADE IOS

hosts: test-wan

connection: network_cli

gather_facts: no

vars:

ansible_connection: network_cli

ansible_network_os: ios

ansible_user:

ansible_ssh_pass:

vars_prompt:

- name: "compliant_ios_version"

prompt: "What is the compliant IOS version?"

private: no

- name: "should_reboot"

prompt: "Reboot IOS node? (YES or NO)"

private: no

tasks:

- name: GATHER SWITCH FACTS

ios_facts:

- name: UPGRADE IOS IMAGE IF NOT COMPLIANT

block:

- name: COPY OVER IOS IMAGE

ios_command:

commands:

- command: "copy ftp://172.16.0.35/c1900-universalk9-mz.SPA.157-3.M3.bin flash0:"

prompt: "Destination filename [c1900-universalk9-mz.SPA.157-3.M3.bin]? "

answer: "\r"

Thanks!



No comments:

Post a Comment