Hi everyone,
I opened an issue <https://github.com/ansible/ansible/issues/69765>at
Github project but unfortunately got closed unexpectedly. I still believe
the there are some compatibility problems between Ansible and WSL, because
the scenario I described in the issue worked fine on local docker as well
as on my vm boxes.
SUMMARY
Unable to establish connection to localhost under Windows Subsystem for
Linux (WSL, Ubuntu)
ISSUE TYPE
- Bug Report
COMPONENT NAME
Network
ANSIBLE VERSION
ansible 2.9.6
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules',
'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]
CONFIGURATION
DEFAULT_LOCAL_TMP(/etc/ansible/ansible.cfg) = /tmp/ansible-local-2309_h96pb5
OS / ENVIRONMENT
OS:
OS Name: Microsoft Windows 10 Pro (Version 1909)
OS Version: 10.0.18363 N/A Build 18363
WSL:
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal
STEPS TO REPRODUCE
Run this command:
ansible localhost -m ping
EXPECTED RESULTS
The ping request successfully poerformed, and Ansible returns the following:
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
ACTUAL RESULTS
The ping request failed. The following error returned:
localhost | UNREACHABLE! => {
"changed": false,
"msg": "Authentication or permission failure. In some cases, you may have
been able to authenticate and did not have permissions on the target directory.
Consider changing the remote tmp path in ansible.cfg to a path rooted in
\"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo
/tmp/ansible-tmp-1590770997.3577683-86430694066473 `\" && echo
ansible-tmp-1590770997.3577683-86430694066473=\"` echo
/tmp/ansible-tmp-1590770997.3577683-86430694066473 `\" ), exited with result 1,
stdout output:
ansible-tmp-1590770997.3577683-86430694066473=/tmp/ansible-tmp-1590770997.3577683-86430694066473\n",
"unreachable": true
}
TROUBLESHOOT ACTIONS TAKEN SO FAR
1. Update ansible.cfg, set remote_tmp to "/tmp"
2. Reinstalled SSHD and enable ssh on WSL
3. Tried reinstalling different versions of Ansible (2.5.X - 2.9.X)
4. Tried setting the connection to local in host file as suggested (new)
5. Tried force local connection from ansible-playbook command (new)
OBSERVATIONS
1. I am able to ssh into localhost from local
2. The command works fine when running inside a docker container
---------------------------------detail
output-----------------------------------
```
root@leoli:/mnt/c/Users/leoli# ansible localhost -vvvv -m ping
ansible 2.9.6
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules',
'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its
verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its
verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its
verify_file() method
Set default localhost to localhost
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from
/usr/lib/python3/dist-packages/ansible/plugins/callback/minimal.py
META: ran handlers
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
/tmp/ansible-tmp-1591053120.0766757-250645184932946 `" && echo
ansible-tmp-1591053120.0766757-250645184932946="` echo
/tmp/ansible-tmp-1591053120.0766757-250645184932946 `" ) && sleep 0'
localhost | UNREACHABLE! => {
"changed": false,
"msg": "Authentication or permission failure. In some cases, you may
have been able to authenticate and did not have permissions on the target
directory. Consider changing the remote tmp path in ansible.cfg to a path
rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo
/tmp/ansible-tmp-1591053120.0766757-250645184932946 `\" && echo
ansible-tmp-1591053120.0766757-250645184932946=\"` echo
/tmp/ansible-tmp-1591053120.0766757-250645184932946 `\" ), exited with
result 1, stdout output:
ansible-tmp-1591053120.0766757-250645184932946=/tmp/ansible-tmp-1591053120.0766757-250645184932946\n,
stderr output: sleep: cannot read realtime clock: Invalid argument\n",
"unreachable": true
}
```
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/130780ea-e83d-4921-92a4-9f6aae5d7428%40googlegroups.com.