ansible-community / ansible-community/molecule-plugins

"Failed to create temporary directory" on converge

Open
#376 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
164
Forks
113
Avg merge
4d 20h
Merged PRs (30d)
1

Description

On versions 26.7.8 and 26.7.15, molecule crashes on the converge step when running `molecule test`, with different playbooks/tests:

> INFO software ➜ converge: Executing
┌──────────────────────────────────────────────────────────────────────────────────
│ ansible-playbook --inventory /home/user2/.ansible/tmp/molecule.DLh_.software/inventory
│ --skip-tags molecule-notest,notest
│ /home/user2/ansible/molecule/software/converge.yml


│ PLAY [Converge] ****************************************************************

│ TASK [Gathering Facts] *********************************************************
│ [ERROR]: Task failed: Failed to create temporary directory. 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", for more error information use -vvv. Failed command was: ( umask 77 &&
│ mkdir -p "` echo ~/.ansible/tmp `"&& mkdir "` echo ~/.ansible/tmp/ansible-tmp-1785850104.153331-1127942-195673740126245 `" && echo
│ ansible-tmp-1785850104.153331-1127942-195673740126245="` echo ~/.ansible/tmp/ansible-tmp-1785850104.153331-1127942-195673740126245 `" ), exited with result 1
│ fatal: [instance]: UNREACHABLE! => {"changed": false, "msg": "Task failed: Failed to create temporary directory. 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\", for more
│ error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp `\"&& mkdir \"` echo
│ ~/.ansible/tmp/ansible-tmp-1785850104.153331-1127942-195673740126245 `\" && echo ansible-tmp-1785850104.153331-1127942-195673740126245=\"` echo
│ ~/.ansible/tmp/ansible-tmp-1785850104.153331-1127942-195673740126245 `\" ), exited with result 1", "unreachable": true}

This is not a permission issue: creating the folder manually works. This seems to be a formatting issue due to the command leaving additional quotes around the directory path:
> $ umask 77 && mkdir -p \"` echo ~/.ansible/tmp `\"&& mkdir \"` echo ~/.ansible/tmp/ansible-tmp-1785850040.039504-1127756-106823443215676 `\" && echo ansible-tmp-1785850040.039504-1127756-106823443215676=\"` echo /.ansible/tmp/ansible-mp-1785850040.039504-1127756-106823443215676 `\"
> mkdir: cannot create directory '"/home/user2/.ansible/tmp/ansible-tmp-1785850040.039504-1127756-106823443215676"': No such file or dire
ctory
> $ mkdir /home/user2/.ansible/tmp/ansible-tmp-1785850040.039504-1127756-1068234432156766
> (no issue)

I can't test earlier versions because they break on ansible 2.21

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing `molecule test` and focus on the converge step, using the generated `ansible-playbook` command and `converge.yml` shown in the report. Trace how the remote temporary-directory command is assembled; done means converge creates the temporary directory without extra quotes and the reported reproducer succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.