一、SSH Multiplexing
1 配置
vim /etc/ssh/ssh_config
Host * GSSAPIAuthentication yes # If this option is set to yes then remote X11 clients will have full access # to the original X11 display. As virtually no X11 client supports the untrusted # mode correctly we set this to yes. ForwardX11Trusted yes # Send locale-related environment variables SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE SendEnv XMODIFIERS ControlMaster yes # 这个是新增的 ControlPath /tmp/%[email protected]%h:%p # 这个是新增的 ControlPersist 10m # 这个是新增的
2 测试
[[email protected] playbooks]# ssh -O check 172.20.6.121 [email protected]‘s password: Master running (pid=16802) # 有这个说明开启成功 上面的不是”零“ 而是大写的0
测试速度
[[email protected] playbooks]# time ssh 172.20.6.121 /bin/true [email protected]‘s password: ControlSocket /tmp/[email protected]:22 already exists, disabling multiplexing real 0m2.137s user 0m0.032s sys 0m0.005s
二、启用pipelining
# 启用pipelining 的ansible.cfg [defaults] pipelining = True