---

- name: create directory /etc/docker-compose/vehicle_discovery
  file:
    dest: /etc/docker-compose/vehicle_discovery
    state: directory
  become: yes

- name: templatize vehicle discovery docker-compose.yml
  template:
    src=docker-compose.yml.j2
    dest=/etc/docker-compose/vehicle_discovery/docker-compose.yml
  become: yes

# Ansible 2.2 pull flag in docker_service still doesn't work as expected if
# any version of the image isn't present on the host
- command: docker-compose pull chdir=/etc/docker-compose/vehicle_discovery
  name: pull vehicle discovery image

- name: run vehicle discovery
  docker_compose:
    project_src: /etc/docker-compose/vehicle_discovery
    pull: yes
    restarted: "{{ vehicle_discovery_restart }}"
    state: "{{ vehicle_discovery_state }}"
