"Unsupported config option" error with the docker_service module

19 views
Skip to first unread message

Valentin Chartier

unread,
Sep 6, 2016, 12:02:56 PM9/6/16
to Ansible Project
Hello,
I am having some trouble using the docker_service module and I 'm looking for some suggestions on how to troubleshoot this.

I have the docker_container working properly.
The issue is with the new docker_service module.

According to the docker_service module (http://docs.ansible.com/ansible/docker_service_module.html) the prereqs on the remote host are :
python >= 2.6
docker-compose >= 1.7.0
Docker API >= 1.20
PyYAML >= 3.11

On my remote host I have :
# python --version
Python 2.7.5
# docker-compose --version
docker-compose version 1.8.0, build f3628c7
# pip list | grep -i pyyaml
PyYAML (3.12)

Not sure what to check for Docker API.
# docker --version
Docker version 1.12.1, build 23cf638

Here is my docker_service task :

  - docker_service:
      project_name: "my project"
      definition:
        version: '2'
        services:
          proxy:
            image: nginx
            state: started
            restart: "yes"
    become: yes
    become_user: root
    register: compose
    tags: compose

I am getting this error :

TASK [my stack] ****************************************************************
fatal: [jenkins2]: FAILED! => {"changed": false, "failed": true, "msg": "Configuration error - The Compose file '/tmp/ansible9p01QT/docker-compose.yml' is invalid because:\nUnsupported config option for services.proxy: 'state'"}

Looks like version: '2' is not taken into account or we are not using the correct version of docker-compose. But I am not seeing the reason for that.

I run Ansible 2.1.1.0 on a Mac, installed it with pip, and the remote host is a CentOS.

Any suggestion ?
Reply all
Reply to author
Forward
0 new messages