Ansible with docker-compose - Error: Can't find a suitable configuration file in this directory

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.

 Note

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
Last updated on 2 Oct 2019
Published on 2 Oct 2019