Molecule: When using docker (image alpine:3.6): Authentication or permission failure

Created on 18 Nov 2017  路  2Comments  路  Source: ansible-community/molecule

Bug report

When trying to test a role against alpine:3.6 (and alpine:3.5) I see an unexected error. Other platforms, such as Fedora, Ubuntu, Debian and CentOS seem to work fine.

Molecule and Ansible details

ansible --version
ansible 2.4.1.0
  config file = None
  configured module search path = [u'/Users/username/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 25 2017, 09:53:22) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]

molecule --version
molecule, version 2.4.0
  • Molecule installation method: pip
  • Ansible installation method: pip

Desired Behaviour

Create a role (works)

molecule init role --driver-name docker --role-name ansible-role-molecule

Modify molecule/default/molecule.yml to run on alpine:3.6 (works)

dependency:
  name: galaxy
driver:
  name: docker
lint:
  name: yamllint
platforms:
  - name: instance
    image: alpine:3.6
provisioner:
  name: ansible
  lint:
    name: ansible-lint
scenario:
  name: default
verifier:
  name: testinfra
  lint:
    name: flake8
molecule test

Normally I would expect a successful test:

molecule test

Actual Behaviour

Run the tests (molecule test) fails:

--> Action: 'converge'

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

    TASK [Gathering Facts] *********************************************************
    fatal: [instance]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote temp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp/ansible-tmp-1511002266.48-250329601373921 `\" && echo ansible-tmp-1511002266.48-250329601373921=\"` echo ~/.ansible/tmp/ansible-tmp-1511002266.48-250329601373921 `\" ), exited with result 1", "unreachable": true}

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

ERROR: 

I'm hoping other can confirm or deny this behaviour.

I have a feeling that Ansible want to write in the container where it's not allowed to or so.

I've tried:

  • Removing ~/.ansible (on the controller node)
  • Setting ansible options:
provisioner:
  name: ansible
  config_options:
    defaults:
      remote_tmp: /tmp/$USER
  • Removing (cached) docker images. (docker system prune)

Attached is a debug log. (replaced my username with "username".)
debug.log

Most helpful comment

Hi @alikins The problem is your container is not running when Ansible is executing. The error message is a red herring.

Molecule attempts to boot the container with `sleep infinity', however, this is not a valid busybox option, and the container is not running when Ansible attempts to converge.

Update your molecule.yml with:

platforms:
  - name: instance
    image: alpine:3.6
    command: bash -c 'while true; do sleep 1; done'

All 2 comments

Hi @alikins The problem is your container is not running when Ansible is executing. The error message is a red herring.

Molecule attempts to boot the container with `sleep infinity', however, this is not a valid busybox option, and the container is not running when Ansible attempts to converge.

Update your molecule.yml with:

platforms:
  - name: instance
    image: alpine:3.6
    command: bash -c 'while true; do sleep 1; done'

Thanks for posting this. You'd think it would be obvious, but no... my container was, indeed, not running.

Was this page helpful?
0 / 5 - 0 ratings