| --- | |
| - hosts: all | |
| connection: network_cli | |
| gather_facts: no | |
| vars: | |
| ansible_network_os: ios | |
| ansible_command_timeout: 720 | |
| tasks: | |
| - name: Copy | |
| ios_command: | |
| commands: "copy tftp://xxx.xxx.xxx.xxx/c2960x-universalk9-mz.152-7.E0a.bin flash:" | |
| prompt: "c2960x-universalk9-mz.152-7.E0a.bin" | |
| answer: "\r" | |
| - name: Show results | |
| debug: msg= {{ results.stdout_lines }}
My error.
fatal: [10.xxx.xxx.xxx]: FAILED! => { 63 "ansible_facts": { 64 "discovered_interpreter_python": "/usr/bin/python" 65 }, 66 "changed": false, 67 "invocation": { 68 "module_args": { 69 "answer": "\r", 70 "commands": "copy tftp://xxx.xxx.xxx.xxx/c2960x-universalk9-mz.152-7.E0a.bin flash:", 71 "prompt": "c2960x-universalk9-mz.152-7.E0a.bin" 72 } 73 }, 74 "msg": "Unsupported parameters for (ios_command) module: answer, prompt Supported parameters include: auth_pass, authorize, commands, host, interval, match, password, port, provider, retries, ssh_keyfile, timeout, username, wait_for" 75 } 76 |
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b94107fc-acad-40f3-9414-b7f02d2a2c41%40googlegroups.com.
all:
hosts:
switch01:
ansible_host: 192.168.100.149 # DHCP address in staging net
children: # grouping in ansible is called „children“
c9200l: # grouping according to hardware
hosts:
switch01:
vars:
compliant_ios_version: 16.12.01
ios_hash: 727cfc785bc304b985656dee660b0382
ios_file: cat9k_lite_iosxe.16.12.01.SPA.bin
The meta playbook is like:
--- - hosts: cisco vars: model: "{{ ansible_net_model | regex_replace('^WS-C(\\d+.).*$', '\\1') }}" tasks: - name: Output debug: msg: "Found model: {{ model }}. Will try to upgrade." - name: Include model series specific upgrade block: - name: do include include: "ios-upgrade-{{ model }}.yaml" when: (ansible_net_version != compliant_ios_version) The playbook for a c2960L is: - name: Copy IOS to device ios_command: commands: - command: 'copy tftp://192.168.100.16/{{ ios_file }} flash:' prompt: 'Destination filename \[{{ ios_file }}\]?' answer: "\r" vars: ansible_command_timeout: 600 - name: Check md5sum of IOS on device ios_command: commands: - command: 'verify /md5 flash:{{ ios_file }} {{ ios_hash }}' register: md5_output - name: Continue if hash matches block: - name: Set new boot variable ios_config: lines: boot system flash:{{ ios_file }} save_when: always - name: Reboot device ios_command: commands: - command: reload prompt: '\[confirm\]' answer: "\r" - name: Wait for switch to reboot wait_for: host: "{{ ansible_host }}" port: 22 delay: 60 timeout: 600 delegate_to: localhost - name: Gather facts of the switch again ios_facts: - name: Assert that the running IOS version is correct assert: that: - compliant_ios_version == ansible_net_version msg: "IOS version does not match compliant version. Upgrade unsuccessful." when: '"Verified" in md5_output.stdout[0]'
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwMDJ9msrtYxkiSW-iLgUv7wKsQW8QViXQ13RXT4HYyYpQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFFTi_LyAYMgduvV7Fz%3D74b2ruM3b8L-E6j3xd5cJZZSn5kPoQ%40mail.gmail.com.

To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b94107fc-acad-40f3-9414-b7f02d2a2c41%40googlegroups.com.
--Sent from a mobile device - please excuse the brevity, spelling and punctuation.--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
--To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwMDJ9msrtYxkiSW-iLgUv7wKsQW8QViXQ13RXT4HYyYpQ%40mail.gmail.com.
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFFTi_LyAYMgduvV7Fz%3D74b2ruM3b8L-E6j3xd5cJZZSn5kPoQ%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/22bb1171-c5f7-4b65-892b-d47782f5a571%40googlegroups.com.