ansible / proposals

Repository for sharing and tracking progress on enhancement proposals for Ansible.
Creative Commons Zero v1.0 Universal
93 stars 19 forks source link

collect ssh pipelining facts in the setup module #84

Open gzm55 opened 6 years ago

gzm55 commented 6 years ago

Proposal: enable ssh pipelining in a more smart way

Author: James Z.M. Gao <@gzm55>

Date: 2017/10/27

Motivation

This is previous a issue in ansible project.

Now ssh pipeline is off by default (p.s., PR #13200 has some problems). We can make ssh pipeline more smart way, that is, enable it as much as possible for each host after the setup module is done.

Problems

  1. default performance is not well optimized
  2. setting ssh_pipelining to improve performance need additional knowledge, such as a) current operations to do; b) remote controlled machine environments; c) which become method is used

Solution proposal

  1. in ansible.cfg, pipelining can be set to 'smart'/True/False
  2. if set to smart (by default), setup module will set ansible_ssh_pipelining as a host fact
  3. when detecting on remote machines:
    • if not find sudo, set ansible_ssh_pipelining to True
    • run some command such as echo id | sudo -S -n sh, if find 'you must have a tty to run sudo' in stderr, set ansible_ssh_pipelining to False
    • other cases, set ansible_ssh_pipelining to True
  4. when executing a non-become task, always enable ssh pipelining, even if ansible_ssh_pipelining is False
  5. each become method could override ansible_ssh_pipelining is different way, such as su should always disable pipe (this is already done)

Dependencies

N/A

Testing

TBD

Documentation

TBD