I have an Ansible role and one of its tasks is to deploy a J2 template.
When deploying via Jenkins, I got this error message:
“msg”: “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: PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand , exited with result 1″,
Knowing that the user used has the necessary permissions on the tmp directory, I tried to decode the encrypted command and execute it manually on the windows host:
one of the commands is as follows:
$tmp_path = [System.Environment]::ExpandEnvironmentVariables(‘%TEMP%’)
$tmp = New-Item -Type Directory -Path $tmp_path -Name ‘ansible-tmp-ID’
when I tried to run it manually, it asks me via a popup “How do you want to open this file” whereas it runs correctly without asking anything on another host for another environment.
Note that the playbook used to work correctly without issue on this host.
Do you have any ideas please?
I tried to manually run the following powershell command:
$tmp = New-Item -Type Directory -Path $tmp_path -Name ‘ansible-tmp-ID’
normally, this would directly create a folder called ‘ansible-tmp-ID’ in the $tmp_path directory
but in my case, it asks me ‘How do you want to open this file’.
DevOps_KM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.