15

Ansible has the ability to work faster when pipelining is enabled. However there are some requirements to make this work. Pipelinging must be enabled in ansible.cfg or in the inventory-file and requiretty must be dissabled.

I already checked -vvvv, nothing showed up concering 'pipelining'. Also, I do not notice any difference in speed.

Because of all this I would like to know if: is there a way to verify Ansible is using the pipelining ability?

Thomas Detemmerman
  • 353
  • 1
  • 3
  • 8

1 Answers1

18

To check if pipelining is in use, call: ansible test-server -vvv -m shell -a 'echo ok'.

If you see only one SSH: EXEC ssh record with something like /bin/sh -c '/usr/bin/python && sleep 0', then pipelining is in use.

If you see three to five SSH: EXEC ssh/SSH: EXEC sftp/PUT records, executing command.py from tmp path, then pipelining mode is not active.

Konstantin Suvorov
  • 65,183
  • 9
  • 162
  • 193
  • 4
    Make sure pipelining = True is defined under ssh_connection and not defaults. – Johno Crawford May 31 '18 at 13:49
  • Weirdly, I had to put it under `defaults` for it to be recognized, _not_ `ssh_connection`. I just verified that pipeline is working using the method described in this answer, and by running `ansible-config dump | grep PIPE`. My `ansible --version` returns `2.11.6`. Maybe there was a regression? – Illya Moskvin Feb 05 '22 at 18:09
  • With pipelining enabled `copy` is still *extremely* slow. To copy a single file I see x10 "SSH: EXEC" in the ouput and x8 with pipelining enabled. One or two of those are warm up stuff but most are done for *every* file if your copying a directory! You can use synchronize but copy should still not be this slow. – spinkus May 27 '22 at 00:05