---
- name: "include docker-central-database"
  include_role: 
    name: docker-central-database

- name: "include create-domains.yml for mastodon"
  include_tasks: create-domains.yml
  loop: "{{ [domains.mastodon] + domains.mastodon_alternates }}"
  loop_control:
    loop_var: domain
  vars:
    http_port: "{{ ports.localhost.http[application_id] }}"

- name: "copy docker-compose.yml and env file"
  include_tasks: copy-docker-compose-and-env.yml

- name: flush docker service
  meta: flush_handlers
  when: applications.mastodon.setup |bool 

- name: setup routine for mastodon
  command:
    cmd: "docker-compose run --rm web bundle exec rails db:migrate"
    chdir: "{{docker_compose.directories.instance}}"
  when: applications.mastodon.setup |bool 

- name: "include create-administrator.yml for mastodon"
  include_tasks: create-administrator.yml