net_put issue, please help :-)

35 views
Skip to first unread message

Alexander Dollny

unread,
Jul 24, 2020, 3:49:02 AM7/24/20
to Ansible Project
Hello all,

I have a question about the net_put Module. I use this to upload .ios images to my cisco devices. For that, I use my MacBook with this configuration 

ansible-playbook --version
ansible-playbook 2.9.10
config file = None
configured module search path = ['/Users/alexander.dollny/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/2.9.10/libexec/lib/python3.8/site-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.8.3 (default, Jul 8 2020, 14:27:55) [Clang 11.0.3 (clang-1103.0.32.62)]

---
- name: upgrade ios switches
hosts: all
gather_facts: false
connection: network_cli

vars:
cli:
host: "{{ inventory_hostname }}"
username: "{{ ansible_user }}"
password: "{{ ansible_ssh_pass }}"

tasks:
- name: image upload
net_put:
src: "/home/alex/images/cat4500e-universalk9.SPA.03.11.02.E.152-7.E2.bin"
dest: "bootflash:/cat4500e-universalk9.SPA.03.11.02.E.152-7.E2.bin"
protocol: scp
vars:
ansible_command_timeout: 7200
...
--------------------------------------------------------------------------------
Everything is working fine with this setup..

But when I com to CentOs (or other Linux) then I have this issue:

centos@ip-10-DEV]$ ansible-playbook -i hosts.ini ./1st/01_upload_image.yml -vvv
ansible-playbook 2.9.11
  config file = /home/centos/repos/GitHub/ansible-ios/DEV/ansible.cfg
  configured module search path = ['/home/centos/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/centos/.local/lib/python3.6/site-packages/ansible
  executable location = /home/centos/.local/bin/ansible-playbook
  python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /home/centos/repos/GitHub/ansible-ios/DEV/ansible.cfg as config file
host_list declined parsing /home/centos/repos/GitHub/ansible-ios/DEV/hosts.ini as it did not pass its verify_file() method
script declined parsing /home/centos/repos/GitHub/ansible-ios/DEV/hosts.ini as it did not pass its verify_file() method
auto declined parsing /home/centos/repos/GitHub/ansible-ios/DEV/hosts.ini as it did not pass its verify_file() method
yaml declined parsing /home/centos/repos/GitHub/ansible-ios/DEV/hosts.ini as it did not pass its verify_file() method
Parsed /home/centos/repos/GitHub/ansible-ios/DEV/hosts.ini inventory source with ini plugin

PLAYBOOK: 01_upload_image.yml **********************************************************************************************************************************************************************************************************
1 plays in ./1st/01_upload_image.yml

PLAY [upgrade ios switches] ************************************************************************************************************************************************************************************************************
META: ran handlers

TASK [image upload] ********************************************************************************************************************************************************************************************************************
task path: /home/centos/repos/GitHub/ansible-ios/DEV/1st/01_upload_image.yml:14
The full traceback is:
Traceback (most recent call last):
  File "/home/centos/.local/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 147, in run
    res = self._execute()
  File "/home/centos/.local/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 660, in _execute
    result = self._handler.run(task_vars=variables)
  File "/home/centos/.local/lib/python3.6/site-packages/ansible/plugins/action/net_put.py", line 131, in run
    result['changed'] = changed
UnboundLocalError: local variable 'changed' referenced before assignment
fatal: [sw4cell.iscout.mgmt]: FAILED! => {}

MSG:

Unexpected failure during module execution.

PLAY RECAP *****************************************************************************************************************************************************************************************************************************
sw4cell        : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

can someone help me with this?

BR

Alex

Reply all
Reply to author
Forward
0 new messages