Provision Ubuntu WSL Environment Using Ansible

Viewed 351

I am able to provision Windows 10 using Ansible/Chocolatey by running Ansible in Ubuntu WSL. I am now trying to provision the Ubuntu WSL environment using that same Ansible instance. It seems to authenticate properly but I'm getting the following permission error when I try to provision Ubuntu WSL from Ubuntu WSL itself:

fatal: [localhost-wsl]: 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-${USER}/tmp/ansible-tmp-1594006839.9280272-267367995921233 `\" && echo ansible-tmp-1594006839.9280272-267367995921233=\"` echo /tmp/.ansible-${USER}/tmp/ansible-tmp-1594006839.9280272-267367995921233 `\" ), exited with 
result 1, stdout output: ansible-tmp-1594006839.9280272-267367995921233=/tmp/.ansible-***/tmp/ansible-tmp-1594006839.9280272-267367995921233\n", "unreachable": true}
[WARNING]: Failure using method (v2_runner_on_unreachable) in callback plugin      
(<ansible.plugins.callback.mail.CallbackModule object at 0x7feccbade550>): [Errno  
111] Connection refused

Here's my inventory.yml:

all:  
  children:
    ubuntu-wsl:
      hosts:        
        localhost-wsl:
          ansible_port: 22
          ansible_host: localhost
          ansible_password: "{{ passwordd}}"
          ansible_user: "{{ usernamee}}"

And here's my ansible.cfg:

[defaults]
inventory = inventory.ymlforks = 50
transport = ssh
gathering = smart
fact_caching = jsonfile
fact_caching_connection =  ~/.ansible/factcachingconnection
callback_whitelist = mailfact_caching_timeout = 60480000hash_behavior = merge
retry_files_enable = False
pipelining = True
host_key_checking = False
remote_tmp = /tmp/.ansible-${USER}/tmp

[winrm_connection]
server_cert_validation = ignore
transport = credssp,ssl

[ssh_connection]
transfer_method = piped

Can anyone spot an error or suggest a possible solution? I was unable to get it working using the local type connection as well (the above is using SSH).

Thanks

1 Answers
Related