geerlingguy / docker-fedora35-ansible

Fedora 35 Docker container for Ansible playbook and role testing.
https://hub.docker.com/r/geerlingguy/docker-fedora35-ansible
MIT License
11 stars 5 forks source link

Container unreachable when used in molecule with command set #1

Open benchoncy opened 2 years ago

benchoncy commented 2 years ago

Ansible reports container as unreachable when used with molecule and the command: value is set.

This issue also appears for the fedora34 image. I've also noticed a related issue on the fedora33 repo.

Versions reported by molecule:

molecule 3.6.1 using python 3.10 
    ansible:2.12.3
    delegated:3.6.1 from molecule
    docker:1.1.0 from molecule_docker requiring collections: community.docker>=1.9.1
    vagrant:1.0.0 from molecule_vagrant

OS: Fedora 35

Error received:

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

TASK [Gathering Facts] *********************************************************
fatal: [instance]: 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-1648128537.5290678-39593-72373769391475 `\" && echo ansible-tmp-1648128537.5290678-39593-72373769391475=\"` echo ~/.ansible/tmp/ansible-tmp-1648128537.5290678-39593-72373769391475 `\" ), exited with result 1", "unreachable": true}

PLAY RECAP *********************************************************************
instance                   : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0

Example molecule.yml:

---
dependency:
  name: galaxy
driver:
  name: docker
platforms:
  - name: instance
    image: "geerlingguy/docker-${MOLECULE_DISTRO:-fedora35}-ansible:latest"
    command: ${MOLECULE_DOCKER_COMMAND:-""}
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
    privileged: true
    pre_build_image: true
provisioner:
  name: ansible

Steps to replicate:

If there is any further information I can provide, do let me know.

stefanDeveloper commented 2 years ago

I run into the exact same issue, thanks for opening it

J-SirL commented 2 years ago

I have the same issue, but I am using registry.redhat.io/ubi8/ubi-init and uasing rotless podman.

]$ molecule --version molecule 4.0.0 using python 3.8 ansible:2.13.1 delegated:4.0.0 from molecule podman:2.0.0 from molecule_podman requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0

-- podman --version podman version 4.0.2

-- upgraded molecule to:

$ molecule --version molecule 4.0.1 using python 3.8 ansible:2.13.1 delegated:4.0.1 from molecule podman:2.0.0 from molecule_podman requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0

Still same result. Anyone got any solution on this issue ?

lj020326 commented 1 year ago

I had the same issue.

I resolved it by removing the 'platforms[].command' key as follows:

---
dependency:
  name: galaxy
driver:
  name: docker
platforms:
  - name: instance
    image: "geerlingguy/docker-${MOLECULE_DISTRO:-fedora35}-ansible:latest"
    #command: ${MOLECULE_DOCKER_COMMAND:-""}
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
    privileged: true
    pre_build_image: true
provisioner:
  name: ansible

If it helps, my molecule configuration and github pipeline actions used to run it can be found in my github repo here

dale-c-anderson commented 1 year ago

Curiously, @j020326's suggested fix from https://github.com/geerlingguy/docker-fedora35-ansible/issues/1#issuecomment-1341085187 also worked for molecule in a github actions job which tests a role against Ubuntu 22.04.