New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting ssh_args disables pipelining mode incorrectly #7251
Comments
Can you please show the output from -vvv ? Thanks! |
Here you go (I've only changed the hostname):
Note: this is obviously with sudo_user set to jason, which is also the username I'm ssh'ing as, setting the username to a different existing username on the remote system looks similar. |
@axelson the above output looks like pipelining is disabled, correct? There should never be a PUT operation when pipelining is enabled, or are you saying that's the problem? |
@jimi-c Yes, that is exactly the problem I'm running For completeness the contents of my ansible.cfg are:
And the contents of my inventory file:
and group_vars/all:
|
What is your transport set to? If you're using EL6 (Centos, RHEL, etc.), you're probably using "smart" by default, which will use paramiko on those systems. The paramiko transport does not do pipelining, only the SSH one does. |
@jimi-c The transport is set to Here's an example run with sudo_user commented out:
You can see in that run that SSH pipelining is working (from my understanding since there are no separate mkdir and chmod command steps). |
I've tried this with both 1.5.5 and the devel branch and can't replicate it to an Ubuntu system. Unfortunately I don't have a Solaris-based system to test against, but it would seem to be something specific to your environment. Using "-e pipelining=True" doesn't do anything, but you have it in your ansible.cfg so that's not the issue. Also, when you set sudo_user to the same user connecting to the system, sudo is actually silently disabled (since there's no need for it), yet in the example output you show above it is still using sudo - so something odd is going on here. |
If I were to get you access to a solaris box to test on, would that help? I might be able to do that. |
Yes, that might help. |
Probably wouldn't, OS X is the control host... |
I'm not sure if this is the same problem, but I have found (via -vvv) that having any value set for ssh_args under [ssh_connection] will cause pipelining to go away. This is not documented behavior. (I have also, oddly, found that putting "-l myuser" as ssh_args will cause Ansible to be unable to log in, even though it sets -o User=myuser later on in the command string...running the same command manually is successful.) |
This bug is still present in 1.7.2. Removing the ssh_args directive allows pipelining to function. Also, specifying both ssh_args and pipelining does not result in an exception or warning. The above PR ensures the user knows about the problem. |
@dpkirchner thanks, I've updated the title to more accurately reflect the issue here, and promoted it to a P2. |
@dpkirchner / @jefferai - I'm unable to replicate the behavior with ssh_args. Could one of you please share what value you're setting that to, so that I can see if it causes the same breakage on my system? Also, you should not specify the |
For me, https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/connection_plugins/ssh.py#L62 Here's my playbook: https://gist.github.com/dpkirchner/c5092daa208df081fc25 I created these yesterday and forgot to upload the ansible.cfg, but it was:
As for IMO, the |
Yeah odd, I can't reproduce the ssh_args issue still: # ansible -m ping ubuntu1404 -vvv <192.168.122.113> ESTABLISH CONNECTION FOR USER: root <192.168.122.113> REMOTE_MODULE ping <192.168.122.113> EXEC ssh -C -q -o ForwardAgent=yes -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 192.168.122.113 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python' 192.168.122.113 | success >> { "changed": false, "ping": "pong" } You can see that option being inserted, and pipelining still occurs. |
I would like to attempt clarify something. ControlMaster/ControlPersist/ControlPath do not indicate "pipelining", while that is beneficial, I just want to point out that there is a difference. Pipelining is where there is a single 'EXEC ssh' line, instead of a EXEC ssh, PUT and a final EXEC ssh. With that being said, can we confirm that we are talking about the same things at this point? The original issue as reported in the first comment is that setting 'sudo_user' caused pipelining to fail, which could not be replicated either. It wasn't until #7251 (comment) (14 days after the issue was opened) that The basic logic that determines if pipelining can be used is:
|
Ahh, so this does not enable a single pipeline for many separate modules I must have messed up my test w/o the ssh_args flag set. |
Yes, so to explain a little further, ControlMaster and pipelining while related are not the same thing. And although not required together, will provide better performance if both used at the same time. ControlMaster as described in the man page for
When you set Pipelining as defined at http://docs.ansible.com/intro_configuration.html#pipelining is:
|
Ok, my mistake for mixing up the two issues. At this point, since the original issue is 5 months old, reported on a version 2 releases old, and was not reproducible, I'm going to go ahead and close this. If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:
Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved. Thank you! |
Quick answer, if you want to use SSH agent forwarding without a big performance penalty, put this in your
More reading: https://groups.google.com/forum/#!topic/ansible-project/Q44ykJkl3c0 |
Issue Type:
Bug Report
Ansible Version:
ansible 1.5.5
Environment:
Running Ansible on Mac OS X Mavericks and managing SmartOS (Solaris).
Summary:
SSH Pipelining [1] doesn't work if sudo_user is set. If I comment out the sudo_user and sudo then the pipelining works.
[1] http://docs.ansible.com/intro_configuration.html#pipelining
Steps To Reproduce:
Here's my simple.yml file:
ansible-playbook -e "pipelining=True" simple.yml
With sudo_user and sudo and running with -vvv I can see that Ansible is running separate mkdir and chmod commands over ssh.
env_var is needed to set PATH for git
Expected Results:
I expect ansible to not send separate SSH commands for mkdir and chmod.
Actual Results:
SSH Pipelining is working so the ssh command for mkdir and chmod are combined.
The text was updated successfully, but these errors were encountered: