iamarunk
iamarunk

Reputation: 145

Error while running (docker_image) module ansible Playbook

I have my docker images in nexus. When i am trying to run that playbook i am getting error

Playbook Code

---
- hosts: localhost
  become: True
  tasks:
    - name: pull an image
      docker_image:
        name: 10.220.110.10:8083/halosys:f5a950f
        source: pull
...

ERROR while running my playbook

TASK [pull an image] ************************************************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (docker_image) module: source Supported parameters include: api_version, archive_path, buildargs, cacert_path, cert_path, container_limits, debug, docker_host, dockerfile, force, http_timeout, key_path, load_path, name, nocache, path, pull, push, repository, rm, ssl_version, state, tag, timeout, tls, tls_hostname, tls_verify, use_tls"}

Please help to fix this error

Upvotes: 2

Views: 3395

Answers (1)

Konrad Botor
Konrad Botor

Reputation: 5033

Option source was added in Ansible 2.8 - see documentation. The error message states it is missing, so you're using older version. To fix this you need to either update your Ansible installation to at least version 2.8 or check the documentation for your version.

For example, Ansible 2.7 documentation states that to pull an image you need to do:

- name: pull an image
  docker_image:
    name: 10.220.110.10:8083/halosys:f5a950f

To check what version of Ansible you're running use command

ansible --version

EDIT:

I can’t guarantee it’ll work, but I would try removing Ansible installed from system packages:

sudo yum remove ansible

followed by installing Python 3:

sudo yum install python36 python36-virtualenv python36-pip

then installing docker-py using pip:

python3 -m pip install docker-py

And finally installing Ansible with Python3 support:

python3 -m pip install ansible

Here’s Ansible documentation about Python3 support.

Also if package python36 is not available you can run

sudo yum list | grep python3

to find what version is available. As per documentation mentioned above you need at least python35 to make Ansible work.

Upvotes: 2

Related Questions