Dear all,
I am geting an error during my playbook running .
i am using ntc-ansible and I want to send command from a text file in a Network for routing configuration
code is like this with ntc ansible
---
- name: Inbound command modification
hosts: ciscors
strategy: debug
connection: local
gather_facts: no
vars:
cli:
ciscoios: 'ciscors'
ciscoiosssh: 'ciscors_ssh'
localfile: 'C:/Users/sg05477/GNS3/images/IOS.bin'
remotefile: 'c7200-advipservicesk9-mz.152-4.S5.bin'
tasks:
- name: Send commands from file
ntc_config_command:
connection: ssh
platform: cisco_ios
commands_file: "send_commands.txt"
host: "{{ inventory_hostname }}"
username: "{{ user }}"
password: "{{ pass }}"
secret: "{{ secret }}"
- debug: var=hostvars[inventory_hostname]
#- debug: var=hostvars[user]
#- debug: var=result.response
#- debug: var=result.response.stdout
During running playbook with ansible , i getting error like
PLAY [Inbound command modification] ************************************************************************************************************************************************************************
TASK [Send commands from file] *****************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: UnboundLocalError: local variable 'output' referenced before assignment
fatal: [192.168.1.11]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_bJ4FjY/ansible_module_ntc_config_command.py\", line 256, in <module>\n main()\n File \"/tmp/ansible_bJ4FjY/ansible_module_ntc_config_command.py\", line 244, in main\n if (error_params(platform, output)):\nUnboundLocalError: local variable 'output' referenced before assignment\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}
Anyone have some solution , how i correct this error.
it will be very helpful.
Thanks
Samya Ghosh