ansible-community / molecule-plugins

Collection on molecule plugins
MIT License
101 stars 67 forks source link

Consistent "SSH: Temporary failure in name resolution" when attempting to utilize docker plugin #208

Open patrickblackjr opened 7 months ago

patrickblackjr commented 7 months ago

Attempting to utilize the Docker plugin is resulting in the following errors no matter what I seem to try.

Error logs

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

TASK [Include webserver config role] *******************************************

TASK [my_role_name : Debug] *****************************************************
ok: [rhel-9] => {
    "msg": "debug from tasks/main.yml"
}

TASK [my_role_name : ansible.builtin.include_vars] ******************************
ok: [rhel-9]

TASK [my_role_name : Create apps folder] ****************************************
fatal: [rhel-9]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname rhel-9: Temporary failure in name resolution", "unreachable": true}

I have reproduced this error in both my local workstation and in CI/CD. So this is either something with molecule/the plugins or my configuration somewhere. I have tried various roles to ensure it's not something specific to the role I am testing.

converge.yml

- name: Converge
  hosts: all
  gather_facts: false
  tasks:
    - name: Include webserver config role
      ansible.builtin.include_role:
        name: my_role_name
        tasks_from: main.yml

molecule.yml

prerun: false
dependency:
  name: galaxy
driver:
  name: docker
lint: |
  yamllint .
  ansible-lint .
platforms:
  - name: rhel-9
    image: redhat/ubi9:9.1.0
    # platform: aarch64
    dockerfile: Dockerfile.j2
    privileged: true
    cgroupns_mode: host
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:rw
    command: /usr/sbin/init
provisioner:
  name: ansible
  log: true

Versions

ansible [core 2.15.5]
molecule 6.0.2 using python 3.10
    ansible:2.15.5
    azure:23.5.0 from molecule_plugins
    containers:23.5.0 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1
    default:6.0.2 from molecule
    docker:2.1.0 from molecule_docker requiring collections: community.docker>=3.0.2 ansible.posix>=1.4.0
    ec2:23.5.0 from molecule_plugins
    gce:23.5.0 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0
    podman:23.5.0 from molecule_plugins requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0
    vagrant:23.5.0 from molecule_plugins
Docker version 24.0.7, build afdd53b
zhan9san commented 7 months ago

@patrickblackjr

Could you please provide the Dockerfile.j2?

And have you tried other docker image?