provision_docker icon indicating copy to clipboard operation
provision_docker copied to clipboard

Error with Arch Linux because of python3

Open hikaru-shindo opened this issue 7 years ago • 1 comments

Hi there,

this role won't work on arch linux because /usr/bin/python (which is used by ansible-playbook) is version 3.6.1 currently.

This leads to the following error using this role:

TASK [chrismeyersfsu.provision_docker : Make sure able to connect to hosts] ******************

The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 97, in run
    item_results = self._run_loop(items)
  File "/usr/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 290, in _run_loop
    res = self._execute(variables=task_vars)
  File "/usr/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 472, in _execute
    self._connection = self._get_connection(variables=variables, templar=templar)
  File "/usr/lib/python3.6/site-packages/ansible/executor/task_executor.py", line 729, in _get_connection
    connection = self._shared_loader_obj.connection_loader.get(conn_type, self._play_context, self._new_stdin)
  File "/usr/lib/python3.6/site-packages/ansible/plugins/__init__.py", line 373, in get
    obj = obj(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/ansible/plugins/connection/docker.py", line 78, in __init__
    docker_version = self._get_docker_version()
  File "/usr/lib/python3.6/site-packages/ansible/plugins/connection/docker.py", line 138, in _get_docker_version
    for line in cmd_output.split('\n'):
TypeError: a bytes-like object is required, not 'str'

fatal: [localhost]: FAILED! => {
    "failed": true,
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

Manually setting /usr/bin/python2 as the executor for ansible-playbook works but that's not a neat soloution.

Also setting ansible_python_interpreter=/usr/bin/python2 won't work here too.

I am not too sure if the problem lies in ansible itself through.

Ansible version is:

ansible 2.3.0.0 config file = /etc/ansible/ansible.cfg configured module search path = Default w/o overrides python version = 3.6.1 (default, Mar 27 2017, 00:27:06) [GCC 6.3.1 20170306]

hikaru-shindo avatar May 26 '17 14:05 hikaru-shindo

The problem is that the docker module hasn't been ported to work with python3.

chrismeyersfsu avatar May 31 '17 14:05 chrismeyersfsu