You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While running the Molecule test cases for an Ansible role, users encounter an issue where Ansible fails to create a temporary directory. This issue hinders the completion of the test execution process. Despite attempts to resolve the problem by specifying a remote_tmp path, the problem persists.
Error:
fatal: [instance-docker]: UNREACHABLE! => changed=false
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: ( umask 77 && mkdir -p "` echo ~/.ansible/tmp `"&& mkdir "` echo ~/.ansible/tmp/ansible-tmp-1713772767.4687226-114022-277068314687868 `" && echo ansible-tmp-1713772767.4687226-114022-277068314687868="` echo ~/.ansible/tmp/ansible-tmp-1713772767.4687226-114022-277068314687868 `" ), exited with result 1'
unreachable: true
Prerequisites
pip check
does not report any conflictsEnvironment
root@sohan:/home/aerohub/Documents/compegon/configuration-management/roles/cgi.example_app# molecule --version
INFO Found config file /home/aerohub/Documents/compegon/configuration-management/.config/molecule/config.yml
molecule 24.2.0 using python 3.10
ansible:2.16.2
azure:23.5.3 from molecule_plugins
containers:23.5.3 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1
default:24.2.0 from molecule
docker:2.1.0 from molecule_docker requiring collections: community.docker>=3.0.2 ansible.posix>=1.4.0
ec2:23.5.3 from molecule_plugins
gce:23.5.3 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0
openstack:23.5.3 from molecule_plugins requiring collections: openstack.cloud>=2.1.0
podman:23.5.3 from molecule_plugins requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0
vagrant:23.5.3 from molecule_plugins
root@sohan:/home/aerohub/Documents/compegon/configuration-management/roles/cgi.example_app# ansible --version
ansible [core 2.16.2]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /root/.local/lib/python3.10/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.0.3
libyaml = True
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
What happened
While running the Molecule test cases for an Ansible role, users encounter an issue where Ansible fails to create a temporary directory. This issue hinders the completion of the test execution process. Despite attempts to resolve the problem by specifying a remote_tmp path, the problem persists.
Error:
It is working fine when host is set to localhost.
Reproducing example
converge.yml
name: Converge
hosts: all
gather_facts: false
pre_tasks:
name: Update apt cache if needed
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
name: Install required application apt packages
ansible.builtin.apt:
name: "{{ item }}"
state: present
with_items:
roles:
driver:
name: docker
platforms:
image: ubuntu:22.04
command: ${MOLECULE_DOCKER_COMMAND:-""}
pre_build_image: true # Use specified image as-is
name: Create application directory
ansible.builtin.file:
path: "{{ example_app.dest_dir }}"
state: directory
mode: "0755"
owner: "{{ example_app.user }}"
group: "{{ example_app.group }}"
name: Clone application repo
ansible.builtin.git:
repo: "{{ example_app.app_repo }}"
dest: "{{ example_app.dest_dir }}"
accept_hostkey: true
version: develop
name: Install dependencies
ansible.builtin.pip:
requirements: "{{ example_app.dest_dir }}/requirements.txt"
virtualenv_python: python3
virtualenv: "{{ example_app.dest_dir }}"
name: Install systemd service unit
ansible.builtin.template:
src: example_app.service.j2
dest: /etc/systemd/system/example_app.service
mode: "0644"
become: true
notify:
The text was updated successfully, but these errors were encountered: