最近在装Ansible,有一台受控端负载重,响应慢。当用Ansible连接它时,总是提示超时。
ansible 192.168.5.37 -m shell -a 'ip a| grep 192.168.'
192.168.5.37 | FAILED | rc=-1 >>
Timeout (12s) waiting for privilege escalation prompt:
vim /etc/sudoers
在行Defaults env_reset下增加
# 单位分钟
Defaults timestamp_timeout = 15
vim /etc/ansible/hosts
# 单位秒
192.168.5.37 ansible_ssh_timeout=30
ansible 192.168.5.37 -m shell -a 'ip a| grep 192.168.'
192.168.5.37 | CHANGED | rc=0 >>
inet 192.168.5.37/24 brd 192.168.5.255 scope global noprefixroute ens192
详见:ansible.builtin.ssh connection – connect via SSH client binary - timeout