ansible / ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
https://www.ansible.com/
GNU General Public License v3.0
63.17k stars 23.93k forks source link

Fix output message in `x transfer mechanism failed` #56779

Open stdedos opened 5 years ago

stdedos commented 5 years ago
SUMMARY

Continuing #22127: I receive:

TASK [Gathering Facts] *********************************************************
[1;35m [WARNING]: sftp transfer mechanism failed on [192.168.0.3]. Use[0m
[1;35mANSIBLE_DEBUG=1 to see detailed information[0m
[1;35m[0m
[1;35m [WARNING]: scp transfer mechanism failed on [192.168.0.3]. Use ANSIBLE_DEBUG=1[0m
[1;35mto see detailed information[0m
[1;35m[0m
[0;32mok: [192.168.0.3][0m

Whereas, a simple

stdout=xyz
stderr=xyz
rc=127

output would save me the trouble of reading the 205 (!!) lines of the the ANSIBLE_DEBUG=1 output

ISSUE TYPE
COMPONENT NAME

Gathering Facts Transfer Mechanism Stdout callback

ANSIBLE VERSION
ansible 2.7.0
  config file = None
  configured module search path = ['/tf/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Apr  8 2019, 18:17:52) [GCC 8.3.0]
CONFIGURATION

# Empty - just the newline
OS / ENVIRONMENT

Alpine OS

STEPS TO REPRODUCE
EXPECTED RESULTS

Compliment:

TASK [Gathering Facts] *********************************************************
[1;35m [WARNING]: sftp transfer mechanism failed on [192.168.0.3]. Use[0m
[1;35mANSIBLE_DEBUG=1 to see detailed information[0m
[1;35m[0m
[1;35m [WARNING]: scp transfer mechanism failed on [192.168.0.3]. Use ANSIBLE_DEBUG=1[0m
[1;35mto see detailed information[0m
[1;35m[0m
[0;32mok: [192.168.0.3][0m

With ssh / command output like:

ssh.stdout=xyz
ssh.stderr=xyz
ssh.rc=127
ACTUAL RESULTS
ansibot commented 5 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

samdoran commented 5 years ago

This information should be returned by running with -vvv without having to use debug.

To discuss this further, please reach out on IRC or the mailing list:

   IRC: #ansible-dev on irc.freenode.net      mailing list: https://groups.google.com/forum/#!forum/ansible-devel

needs_info

DrHashi commented 5 years ago

Same issue in 2.8

samdoran commented 5 years ago

@DrHashi Did you try looking at the output of -vvv and -vvvv to see if that is easier to use than debug output? I confirmed that ssh connection failure information is in the output of -vvv and detailed ssh connection messages are in -vvvv.

DrHashi commented 5 years ago

@DrHashi Did you try looking at the output of -vvv and -vvvv to see if that is easier to use than debug output? I confirmed that ssh connection failure information is in the output of -vvv and detailed ssh connection messages are in -vvvv.

I actually found the problem, it was the IPS killing the ssh tunnel while deploying.


>>>packet_write_wait: Connection to UNKNOWN port 0: Broken pipe
--
 <<<
stdedos commented 5 years ago

Quote @samdoran:

This information should be returned by running with -vvv without having to use debug.

To discuss this further, please reach out on IRC or the mailing list:

   IRC: #ansible-dev on irc.freenode.net      mailing list: groups.google.com/forum/#!forum/ansible-devel

needs_info

I have tried to drop in IRC a couple of times (however, I haven't used an always-running IRC client in years), and I have opened this topic https://groups.google.com/forum/#!topic/ansible-devel/PPZsEoRyZoY with no comments in almost a week

I am not sure what it is that would be preferable to discuss outside of this ticket - I feel that the "default stdout callback" merits numerous small "quality of life" fixes what would have been life-saving for beginners that IMHO they should've been visible and "documented/issued" already, if not fixed.

Please advise on how to continue. If it is helpful somehow, I am on the GMT+3 timezone.

bot_status

ansibot commented 5 years ago
Components [lib/ansible/modules/system/gather_facts.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/system/gather_facts.py) support: core maintainers: ansible
Metadata **waiting_on**: maintainer [needs_info](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md#label-needs_info): False

click here for bot help

DrHashi commented 5 years ago

The output could be more useful but I've found that some Firewall will treat the high data transfer through SSH as an intrusion and kill the connection.

ansibot commented 5 years ago

@stdedos This issue is waiting for your response. Please respond or the issue will be closed.

click here for bot help

stdedos commented 5 years ago

@ansibot No, it is not.

vbotka commented 4 years ago

FWIW.

[WARNING]: sftp transfer mechanism failed on [test_01]. Use ANSIBLE_DEBUG=1 to see detailed
information

is caused by missing line

Subsystem   sftp    /usr/libexec/sftp-server

in /etc/ssh/sshd_config of the remote host.

ansibot commented 4 years ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

s-hertel commented 3 years ago

We do display the stderr and stdout after attempting all methods, but only for the last one. We should fix this by saving the previous errors and include them in the message if all transfer attempts fail.

ansibot commented 3 years ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help