geerlingguy / docker-fedora33-ansible

Fedora 33 Docker container for Ansible playbook and role testing.
https://hub.docker.com/repository/docker/geerlingguy/docker-fedora33-ansible
MIT License
10 stars 3 forks source link

molecule test fails to create temporary directory #2

Open Xat59 opened 3 years ago

Xat59 commented 3 years ago

Hi men,

looking for a way to test some ansible role using molecule, but I have an issue with your fedora33 image, and with fedora34.

Here is my molecule.yml :

---
dependency:
  name: galaxy
driver:
  name: docker
lint: |
  set -e
  yamllint .
  ansible-lint
platforms:
  - name: instance-fedora34
    image: geerlingguy/docker-fedora34-ansible
    pre_build_image: true
    command: ${MOLECULE_DOCKER_COMMAND:-""}
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
    privileged: true
  - name: instance-fedora33
    image: geerlingguy/docker-fedora33-ansible
    pre_build_image: true
    command: ${MOLECULE_DOCKER_COMMAND:-""}
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
    privileged: true
  - name: instance-ubuntu2004
    image: geerlingguy/docker-ubuntu2004-ansible
    pre_build_image: true
    command: ${MOLECULE_DOCKER_COMMAND:-""}
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
    privileged: true
  - name: instance-ubuntu1804
    image: geerlingguy/docker-ubuntu1804-ansible
    pre_build_image: true
    command: ${MOLECULE_DOCKER_COMMAND:-""}
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
    privileged: true
provisioner:
  name: ansible
verifier:
  name: ansible

Also tried with this provisioner config unsuccessfully :

provisioner:
  name: ansible
  config_options:
    defaults:
      remote_tmp: /var/tmp/ansiblexat

I don't have any problem with ubuntu images, only with fedora images. Here is the molecule test output :

INFO     default scenario test matrix: dependency, lint, cleanup, destroy, syntax, create, prepare, converge, idempotence, side_effect, verify, cleanup, destroy
INFO     Performing prerun...
INFO     Using .cache/roles/xat.terraform symlink to current repository in order to enable Ansible to find the role using its expected full name.
INFO     Added ANSIBLE_ROLES_PATH=~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:./.cache/roles
INFO     Running default > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default > lint
COMMAND: set -e
yamllint .
ansible-lint

Loading custom .yamllint config file, this extends our internal yamllint config.
INFO     Running default > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default > destroy
INFO     Sanity checks: 'docker'

PLAY [Destroy] *****************************************************************

TASK [Destroy molecule instance(s)] ********************************************
changed: [localhost] => (item=instance-fedora34)
changed: [localhost] => (item=instance-fedora33)
changed: [localhost] => (item=instance-ubuntu2004)
changed: [localhost] => (item=instance-ubuntu1804)

TASK [Wait for instance(s) deletion to complete] *******************************
ok: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '731694343150.25969', 'results_file': '/home/xat/.ansible_async/731694343150.25969', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-fedora34-ansible', 'name': 'instance-fedora34', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})
ok: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '305755974749.25988', 'results_file': '/home/xat/.ansible_async/305755974749.25988', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-fedora33-ansible', 'name': 'instance-fedora33', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})
ok: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '779645626844.26004', 'results_file': '/home/xat/.ansible_async/779645626844.26004', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-ubuntu2004-ansible', 'name': 'instance-ubuntu2004', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})
ok: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '674436598191.26038', 'results_file': '/home/xat/.ansible_async/674436598191.26038', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-ubuntu1804-ansible', 'name': 'instance-ubuntu1804', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})

TASK [Delete docker network(s)] ************************************************

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

INFO     Running default > syntax

playbook: /home/xat/ansible-role-terraform/molecule/default/converge.yml
INFO     Running default > create

PLAY [Create] ******************************************************************

TASK [Log into a Docker registry] **********************************************
skipping: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-fedora34-ansible', 'name': 'instance-fedora34', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
skipping: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-fedora33-ansible', 'name': 'instance-fedora33', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
skipping: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-ubuntu2004-ansible', 'name': 'instance-ubuntu2004', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
skipping: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-ubuntu1804-ansible', 'name': 'instance-ubuntu1804', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})

TASK [Check presence of custom Dockerfiles] ************************************
ok: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-fedora34-ansible', 'name': 'instance-fedora34', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
ok: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-fedora33-ansible', 'name': 'instance-fedora33', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
ok: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-ubuntu2004-ansible', 'name': 'instance-ubuntu2004', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
ok: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-ubuntu1804-ansible', 'name': 'instance-ubuntu1804', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})

TASK [Create Dockerfiles from image names] *************************************
skipping: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-fedora34-ansible', 'name': 'instance-fedora34', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
skipping: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-fedora33-ansible', 'name': 'instance-fedora33', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
skipping: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-ubuntu2004-ansible', 'name': 'instance-ubuntu2004', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
skipping: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-ubuntu1804-ansible', 'name': 'instance-ubuntu1804', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})

TASK [Discover local Docker images] ********************************************
ok: [localhost] => (item={'changed': False, 'skipped': True, 'skip_reason': 'Conditional result was False', 'item': {'command': '', 'image': 'geerlingguy/docker-fedora34-ansible', 'name': 'instance-fedora34', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item', 'i': 0, 'ansible_index_var': 'i'})
ok: [localhost] => (item={'changed': False, 'skipped': True, 'skip_reason': 'Conditional result was False', 'item': {'command': '', 'image': 'geerlingguy/docker-fedora33-ansible', 'name': 'instance-fedora33', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item', 'i': 1, 'ansible_index_var': 'i'})
ok: [localhost] => (item={'changed': False, 'skipped': True, 'skip_reason': 'Conditional result was False', 'item': {'command': '', 'image': 'geerlingguy/docker-ubuntu2004-ansible', 'name': 'instance-ubuntu2004', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item', 'i': 2, 'ansible_index_var': 'i'})
ok: [localhost] => (item={'changed': False, 'skipped': True, 'skip_reason': 'Conditional result was False', 'item': {'command': '', 'image': 'geerlingguy/docker-ubuntu1804-ansible', 'name': 'instance-ubuntu1804', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item', 'i': 3, 'ansible_index_var': 'i'})

TASK [Build an Ansible compatible image (new)] *********************************
skipping: [localhost] => (item=molecule_local/geerlingguy/docker-fedora34-ansible)
skipping: [localhost] => (item=molecule_local/geerlingguy/docker-fedora33-ansible)
skipping: [localhost] => (item=molecule_local/geerlingguy/docker-ubuntu2004-ansible)
skipping: [localhost] => (item=molecule_local/geerlingguy/docker-ubuntu1804-ansible)

TASK [Create docker network(s)] ************************************************

TASK [Determine the CMD directives] ********************************************
ok: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-fedora34-ansible', 'name': 'instance-fedora34', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
ok: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-fedora33-ansible', 'name': 'instance-fedora33', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
ok: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-ubuntu2004-ansible', 'name': 'instance-ubuntu2004', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})
ok: [localhost] => (item={'command': '', 'image': 'geerlingguy/docker-ubuntu1804-ansible', 'name': 'instance-ubuntu1804', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']})

TASK [Create molecule instance(s)] *********************************************
changed: [localhost] => (item=instance-fedora34)
changed: [localhost] => (item=instance-fedora33)
changed: [localhost] => (item=instance-ubuntu2004)
changed: [localhost] => (item=instance-ubuntu1804)

TASK [Wait for instance(s) creation to complete] *******************************
FAILED - RETRYING: Wait for instance(s) creation to complete (300 retries left).
changed: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '886074904099.26362', 'results_file': '/home/xat/.ansible_async/886074904099.26362', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-fedora34-ansible', 'name': 'instance-fedora34', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})
changed: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '893706017481.26379', 'results_file': '/home/xat/.ansible_async/893706017481.26379', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-fedora33-ansible', 'name': 'instance-fedora33', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})
FAILED - RETRYING: Wait for instance(s) creation to complete (300 retries left).
changed: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '167985668009.26395', 'results_file': '/home/xat/.ansible_async/167985668009.26395', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-ubuntu2004-ansible', 'name': 'instance-ubuntu2004', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})
changed: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '67195595147.26427', 'results_file': '/home/xat/.ansible_async/67195595147.26427', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-ubuntu1804-ansible', 'name': 'instance-ubuntu1804', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})

PLAY RECAP *********************************************************************
localhost                  : ok=5    changed=2    unreachable=0    failed=0    skipped=4    rescued=0    ignored=0

INFO     Running default > prepare
WARNING  Skipping, prepare playbook not configured.
INFO     Running default > converge

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

TASK [Gathering Facts] *********************************************************
fatal: [instance-fedora34]: 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 /var/tmp/ansiblexat `\"&& mkdir \"` echo /var/tmp/ansiblexat/ansible-tmp-1622712169.5916774-26867-186381114684713 `\" && echo ansible-tmp-1622712169.5916774-26867-186381114684713=\"` echo /var/tmp/ansiblexat/ansible-tmp-1622712169.5916774-26867-186381114684713 `\" ), exited with result 1", "unreachable": true}
fatal: [instance-fedora33]: 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 /var/tmp/ansiblexat `\"&& mkdir \"` echo /var/tmp/ansiblexat/ansible-tmp-1622712169.5978546-26866-39702708326876 `\" && echo ansible-tmp-1622712169.5978546-26866-39702708326876=\"` echo /var/tmp/ansiblexat/ansible-tmp-1622712169.5978546-26866-39702708326876 `\" ), exited with result 1", "unreachable": true}
ok: [instance-ubuntu1804]
ok: [instance-ubuntu2004]

TASK [Include ansible-role-terraform] ******************************************

TASK [xat.terraform : TERRAFORM | Create temporary directory] ******************
ok: [instance-ubuntu1804]
ok: [instance-ubuntu2004]

TASK [xat.terraform : TERRAFORM | Get user home path] **************************
ok: [instance-ubuntu1804] => {
    "lookup('env','HOME')": "/home/xat"
}
ok: [instance-ubuntu2004] => {
    "lookup('env','HOME')": "/home/xat"
}

TASK [xat.terraform : TERRAFORM | Download tfswitch installer] *****************
ok: [instance-ubuntu2004]
ok: [instance-ubuntu1804]

TASK [xat.terraform : TERRAFORM | Install tfswitch] ****************************
fatal: [instance-ubuntu2004]: FAILED! => {"changed": false, "cmd": ["/tmp/ansibleterraformf2xw7_sy/install.sh", "-b", "/home/xat/.local/bin/"], "delta": "0:00:00.054612", "end": "2021-06-03 09:22:57.736912", "msg": "non-zero return code", "rc": 1, "start": "2021-06-03 09:22:57.682300", "stderr": "warrensbox/terraform-switcher info checking GitHub for latest tag\nwarrensbox/terraform-switcher crit http_download unable to find wget or curl\nwarrensbox/terraform-switcher crit unable to find '' - use 'latest' or see https://github.com/warrensbox/terraform-switcher/releases for details", "stderr_lines": ["warrensbox/terraform-switcher info checking GitHub for latest tag", "warrensbox/terraform-switcher crit http_download unable to find wget or curl", "warrensbox/terraform-switcher crit unable to find '' - use 'latest' or see https://github.com/warrensbox/terraform-switcher/releases for details"], "stdout": "", "stdout_lines": []}
fatal: [instance-ubuntu1804]: FAILED! => {"changed": false, "cmd": ["/tmp/ansibleterraformq5ww0byu/install.sh", "-b", "/home/xat/.local/bin/"], "delta": "0:00:00.055590", "end": "2021-06-03 09:22:57.741855", "msg": "non-zero return code", "rc": 1, "start": "2021-06-03 09:22:57.686265", "stderr": "warrensbox/terraform-switcher info checking GitHub for latest tag\nwarrensbox/terraform-switcher crit http_download unable to find wget or curl\nwarrensbox/terraform-switcher crit unable to find '' - use 'latest' or see https://github.com/warrensbox/terraform-switcher/releases for details", "stderr_lines": ["warrensbox/terraform-switcher info checking GitHub for latest tag", "warrensbox/terraform-switcher crit http_download unable to find wget or curl", "warrensbox/terraform-switcher crit unable to find '' - use 'latest' or see https://github.com/warrensbox/terraform-switcher/releases for details"], "stdout": "", "stdout_lines": []}

PLAY RECAP *********************************************************************
instance-fedora33          : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
instance-fedora34          : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
instance-ubuntu1804        : ok=4    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
instance-ubuntu2004        : ok=4    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

CRITICAL Ansible return code was 4, command was: ansible-playbook --inventory /home/xat/.cache/molecule/ansible-role-terraform/default/inventory --skip-tags molecule-notest,notest /home/xat/ansible-role-terraform/molecule/default/converge.yml
WARNING  An error occurred during the test sequence action: 'converge'. Cleaning up.
INFO     Running default > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default > destroy

PLAY [Destroy] *****************************************************************

TASK [Destroy molecule instance(s)] ********************************************
changed: [localhost] => (item=instance-fedora34)
changed: [localhost] => (item=instance-fedora33)
changed: [localhost] => (item=instance-ubuntu2004)
changed: [localhost] => (item=instance-ubuntu1804)

TASK [Wait for instance(s) deletion to complete] *******************************
FAILED - RETRYING: Wait for instance(s) deletion to complete (300 retries left).
changed: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '750852100650.28816', 'results_file': '/home/xat/.ansible_async/750852100650.28816', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-fedora34-ansible', 'name': 'instance-fedora34', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})
changed: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '795639582161.28833', 'results_file': '/home/xat/.ansible_async/795639582161.28833', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-fedora33-ansible', 'name': 'instance-fedora33', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})
FAILED - RETRYING: Wait for instance(s) deletion to complete (300 retries left).
FAILED - RETRYING: Wait for instance(s) deletion to complete (299 retries left).
changed: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '79539577262.28849', 'results_file': '/home/xat/.ansible_async/79539577262.28849', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-ubuntu2004-ansible', 'name': 'instance-ubuntu2004', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})
changed: [localhost] => (item={'started': 1, 'finished': 0, 'ansible_job_id': '133612224360.28880', 'results_file': '/home/xat/.ansible_async/133612224360.28880', 'changed': True, 'failed': False, 'item': {'command': '', 'image': 'geerlingguy/docker-ubuntu1804-ansible', 'name': 'instance-ubuntu1804', 'pre_build_image': True, 'privileged': True, 'volumes': ['/sys/fs/cgroup:/sys/fs/cgroup:ro']}, 'ansible_loop_var': 'item'})

TASK [Delete docker network(s)] ************************************************

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

INFO     Pruning extra files from scenario ephemeral directory

As you can see, for fedora33 and fedora34 I get this error : Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory.

Here is the repo I am trying to test : https://github.com/Xat59/ansible-role-terraform

Thanks a lot for your work and for your help.

Xat59 commented 3 years ago

It happens only when I do molecule test, but this problem does not occur using travis-ci !

Any idea ?

kvendingoldo commented 3 months ago

btw. you can also use tenv that support Terraform as well as OpenTofu (and Terragrunt :) ) in one tool. It allow you to simplify version management and can do much more, than tfswitch.