---
- name: Install Composer
  shell: curl -fsSL https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
  args:
    warn: no

- name: Ensure vendor folder exists
  file: path="{{ item }}" state=directory owner=azuracast group=www-data mode=0744
  with_items:
    - "{{ www_base }}/vendor"

- name: Install Composer Dependencies (Development)
  become: true
  become_user: azuracast
  shell: composer install
  args:
    chdir: "{{ www_base }}"
  when: app_env == "development"

- name: Install Composer Dependencies (Production)
  become: true
  become_user: azuracast
  shell: composer install --no-dev --optimize-autoloader
  args:
    chdir: "{{ www_base }}"
  when: app_env == "production"

---
- name: Install Composer
  shell: curl -fsSL https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
  args:
    warn: no

- name: Ensure vendor folder exists
  file: path="{{ item }}" state=directory owner=azuracast group=www-data mode=0744
  with_items:
    - "{{ www_base }}/vendor"
    - "{{ www_base }}/composer.lock"

- name: Install Composer Dependencies (Development)
  become: true
  become_user: azuracast
  shell: composer install
  args:
    chdir: "{{ www_base }}"
  when: app_env == "development"

- name: Install Composer Dependencies (Production)
  become: true
  become_user: azuracast
  shell: composer install --no-dev --optimize-autoloader
  args:
    chdir: "{{ www_base }}"
  when: app_env == "production"

Allow Ansible to override composer.lock from composer merge plugin.
Allow Ansible to override composer.lock from composer merge plugin.

