# vim: ft=yaml.ansible
---
- name: Set up external services network
  docker_network:
    name: external_services

- name: Deploy all services
  include_tasks:
    file: block.yml
  vars:
    service: "{{ item }}"
  loop: "{{ services | dict2items(key_name='name', value_name='vars') }}"
  when: single_service is not defined and
        (item.vars.disabled_in_vagrant is not defined or
        not (item.vars.disabled_in_vagrant and vagrant))

- name: Deploy single service
  include_tasks:
    file: block.yml
  vars:
    service: "{{ {single_service: services[single_service]} | dict2items(key_name='name', value_name='vars') | join }}"
  when: single_service is defined and single_service in services and
        (services[single_service].disabled_in_vagrant is not defined or
        not (services[single_service].disabled_in_vagrant and vagrant))