You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Collection Version
----------------- -------
ansible.netcommon 4.1.0
# /home/john/.ansible/collections/ansible_collections
Collection Version
----------------- -------
ansible.netcommon 5.1.2
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT
Ubuntu
STEPS TO REPRODUCE
Execute the example playbook and set target to a machine that does not have telnet enabled (to trigger error message)
---
- name: Test playbook for ansible.netcommon.telnethosts: localhost # Assuming this playbook will run on the control nodegather_facts: falsetasks:
- name: Execute telnet commandansible.netcommon.telnet:
host: "10.1.1.1"port: 23user: "admin"password: "admin"command:
- "ls"register: telnet_output
- name: Display telnet outputdebug:
var: telnet_output.stdout_lines
EXPECTED RESULTS
An error message along the lines of Module failed to establish a connection to the target host: <reason>
ACTUAL RESULTS
ansible-playbook [core 2.14.5]
config file = None
configured module search path = ['/home/john/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /data/john/projects/cf/env/lib/python3.10/site-packages/ansible
ansible collection location = /home/john/.ansible/collections:/usr/share/ansible/collections
executable location = /data/john/projects/cf/env/bin/ansible-playbook
python version = 3.10.11 (main, Apr 20 2023, 19:02:41) [GCC 11.2.0] (/data/john/projects/cf/env/bin/python)
jinja version = 3.1.2
libyaml = True
No config file found; using defaults
setting up inventory plugins
host_list declined parsing /data/john/projects/cf/data/module_yaml/20230720-184644/lv3/ansible.netcommon.telnet/hosts.ini as it did not pass its verify_file() method
script declined parsing /data/john/projects/cf/data/module_yaml/20230720-184644/lv3/ansible.netcommon.telnet/hosts.ini as it did not pass its verify_file() method
auto declined parsing /data/john/projects/cf/data/module_yaml/20230720-184644/lv3/ansible.netcommon.telnet/hosts.ini as it did not pass its verify_file() method
yaml declined parsing /data/john/projects/cf/data/module_yaml/20230720-184644/lv3/ansible.netcommon.telnet/hosts.ini as it did not pass its verify_file() method
Parsed /data/john/projects/cf/data/module_yaml/20230720-184644/lv3/ansible.netcommon.telnet/hosts.ini inventory source with ini plugin
Loading collection ansible.netcommon from /home/john/.ansible/collections/ansible_collections/ansible/netcommon
Loading callback plugin default of type stdout, v2.0 from /data/john/projects/cf/env/lib/python3.10/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: example.yaml *********************************************************
Positional arguments: example.yaml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/data/john/projects/cf/data/module_yaml/20230720-184644/lv3/ansible.netcommon.telnet/hosts.ini',)
forks: 5
1 plays in example.yaml
PLAY [Test playbook for ansible.netcommon.telnet] ******************************
TASK [Execute telnet command] **************************************************
task path: /data/john/projects/cf/data/module_yaml/20230720-184644/lv3/ansible.netcommon.telnet/example.yaml:7
The full traceback is:
Traceback (most recent call last):
File "/data/john/projects/cf/env/lib/python3.10/site-packages/ansible/executor/task_executor.py", line 158, in run
res = self._execute()
File "/data/john/projects/cf/env/lib/python3.10/site-packages/ansible/executor/task_executor.py", line 633, in _execute
result = self._handler.run(task_vars=vars_copy)
File "/home/john/.ansible/collections/ansible_collections/ansible/netcommon/plugins/action/telnet.py", line 59, in run
self.tn = telnetlib.Telnet(host, port, timeout)
File "/home/john/miniconda3/envs/3.10/lib/python3.10/telnetlib.py", line 218, in __init__
self.open(host, port, timeout)
File "/home/john/miniconda3/envs/3.10/lib/python3.10/telnetlib.py", line 235, in open
self.sock = socket.create_connection((host, port), timeout)
File "/home/john/miniconda3/envs/3.10/lib/python3.10/socket.py", line 845, in create_connection
raise err
File "/home/john/miniconda3/envs/3.10/lib/python3.10/socket.py", line 833, in create_connection
sock.connect(sa)
OSError: [Errno 113] No route to host
fatal: [localhost]: FAILED! => {
"msg": "Unexpected failure during module execution: [Errno 113] No route to host",
"stdout": ""
}
PLAY RECAP *********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
The text was updated successfully, but these errors were encountered:
SUMMARY
Telnet module error should be more explicit about errors during connection establishment. Currently the output is vague
ISSUE TYPE
COMPONENT NAME
telnet
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Ubuntu
STEPS TO REPRODUCE
EXPECTED RESULTS
An error message along the lines of
Module failed to establish a connection to the target host: <reason>
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: