Ansible "failed to resolve remote temporary directory from ansible-tmp" final solution

The summary was originally ansible1.9.x version, and later appeared after upgrading the ansible version, failed to resolve remote temporary directory from ansible-tmp... problem. Even the most basic ping module can't be used.
The version of ansible used now is: 2.2.1.0

[root@localhost ansible]# ansible --version
ansible 2.2.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

 
Questions are as follows:

[root@localhost ansible]# ansible all -m ping
10.0.10.2 | FAILED! => {
    "failed": true,
    "msg": "failed to resolve remote temporary directory from ansible-tmp-1497056262.2-2494116636663 `( umask 77 && mkdir -p \"` echo ~/.ansible/tmp/ansible-tmp-1497056262.2-249411663666383 `\" && echnsible-tmp-1497056262.2-249411663666383=\"` echo ~/.ansible/tmp/ansible-tmp-1497056262.2-249411663663 `\" )` returned empty string"
}

 
Problem analysis:

This problem is essentially due to the introduction of ControlMaster in Ansbile 2.x to optimize the consumption of ssh links. But this ControlMaster depends on openssh. If a higher version of openssh happens to be installed on the machine, then there will be no problem. Then if it is not installed, then it is an ansible bug again. Well, now that the problem is found, the solution is natural.

The following is a supplementary explanation of the working principle of ControlMaster.

When using OpenSSH to log in to a remote server, we usually do this: ssh user@IP executes this command. After successfully logging in to the server, the client establishes a secure TCP/IP connection with the server. Every time the user executes a command, a new connection will be established, and the connection will be maintained until the user exits. If the user has a large number of connection requests, it is necessary to establish and maintain a large number of TCP/IP connections, consuming the resources of the user and the host. OpenSSH provides a feature called ControlMaster that can effectively alleviate this problem. After using ControlMaster, ssh establishes a Master connection with the server, and all subsequent connections can reuse this channel, which means that no matter how many access requests there are, only one TCP/IP connection needs to be maintained.
Method 1: This is a great solution I first saw on gitbub, which is to turn off the ssh ControlMaster function.



 
This solution is indeed feasible, but I have no choice. Because I think there is a reason, so I finally found out that it is the problem of openssh.

Method 2: Install a higher version of openssh:

yum update openssl openssh openssh-server openssh-clients -y

 
Okay, this problem is solved

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326490294&siteId=291194637