I came across the following error when using docker-compose with Ansible for the first time.



    
     "msg": "Configuration error
    Can't find a suitable configuration 
    file in this directory or any parent. Are you in 
    the right directory?   
    Supported filenames: docker-compose.yml, docker-compose.yaml"

The fix.

Make sure you copy your docker-compose.yml across to the remote host before running docker-compose!


    
    - name: Copy compose source templates
      template:
        src: docker-compose.yml
        dest: "{{ docker_compose_dir }}"
        mode: 0600
    
    # do rest of actions
    
    - name: Start the containers
      docker_compose:
        project_src: "{{ docker_compose_dir }}"
      register: docker_compose_start