---
- name: "load docker, db and proxy for {{ application_id }}"
  include_role: 
    name: cmp-db-docker-proxy

- name: Integrate LDAP
  include_tasks: 01_ldap.yml
  when: applications | get_app_conf(application_id, 'features.ldap', False)

# General
- name: "flush handlers to ensure that '{{ friendica_container }}' is up before executing container tasks"
  meta: flush_handlers
  
- name: Check if Friendica local.config.php exists
  command: docker exec --user {{ friendica_user }} {{ friendica_container }} test -f {{ friendica_config_file }}
  register: friendica_config_exists
  changed_when: false
  failed_when: false

- name: Patch Friendica local.config.php with updated DB credentials
  include_tasks: 02_patch_config.yml
  when: friendica_config_exists.rc == 0

- name: Add Friendica Add Ons
  include_tasks: 03_addons.yml