patternMinor
Ansible temp dir change
Viewed 0 times
changetempdiransible
Problem
Ansible version 2.9.2
Is it possible to change ansible temp dir for one playbook only?
I have VMs with r/o root. So, the playbook fails.
Even if I run my playbook under root user on target VM it can't create ansible temp files that it creates in current user's home dir on target VM.
I know that I can change it in ansible.cfg file, but I need it only for one VM type.
I need to make changes to other not r/o drives.
Is it possible to change ansible temp dir for one playbook only?
I have VMs with r/o root. So, the playbook fails.
Even if I run my playbook under root user on target VM it can't create ansible temp files that it creates in current user's home dir on target VM.
I know that I can change it in ansible.cfg file, but I need it only for one VM type.
I need to make changes to other not r/o drives.
Solution
Q: "Is it possible to change ansible temp dir for one playbook only? I have VMs with r/o root."
A: Yes. It's possible. Configure the variable ansible_remote_tmp.
In some cases, a better solution to this problem is ANSIBLE_PIPELINING. Quoting from Risks and limitations of become:
Use pipelining. When pipelining is enabled, Ansible does not save the module to a temporary file on the client. Instead, it pipes the module to the remote python interpreter’s stdin. Pipelining does not work for python modules involving file transfer (for example: copy, fetch, template), or for non-python modules.
Notes:
The ANSIBLE_REMOTE_TMP environment variable has been added to supplement (and override) ANSIBLE_REMOTE_TEMP. This matches the spelling of the config value. ANSIBLE_REMOTE_TEMP will be deprecated in the future.
-
-
See
-
See open bugs
A: Yes. It's possible. Configure the variable ansible_remote_tmp.
In some cases, a better solution to this problem is ANSIBLE_PIPELINING. Quoting from Risks and limitations of become:
Use pipelining. When pipelining is enabled, Ansible does not save the module to a temporary file on the client. Instead, it pipes the module to the remote python interpreter’s stdin. Pipelining does not work for python modules involving file transfer (for example: copy, fetch, template), or for non-python modules.
Notes:
- Quoting from Release notes:
The ANSIBLE_REMOTE_TMP environment variable has been added to supplement (and override) ANSIBLE_REMOTE_TEMP. This matches the spelling of the config value. ANSIBLE_REMOTE_TEMP will be deprecated in the future.
-
remote_tmp is not among configuration options in Ansible Configuration Settings-
See
remote_tmp parameter of the sh plugin.-
See open bugs
Context
StackExchange DevOps Q#10703, answer score: 8
Revisions (0)
No revisions yet.