---
- name: copy parameters.yml template for Symfony project
  template:
    src=symfony_parameters.yml
    dest="{{ home }}/site/app/config/parameters.yml"

- name: check vendor/ for Symfony project
  stat: path="{{ home }}/site/vendor/"
  changed_when: false
  register: vendor

- name: Composer install for Symfony project
  composer:
    command=install
    working_dir="{{ home }}/site"
    prefer_dist=yes
    no_dev=no
  # warnings about an outdated composer.lock file might be sent to stderr, which makes Ansible think the task failed... it didn't, so we'll ignore errors
  ignore_errors: yes
  when: not vendor.stat.exists or not vendor.stat.isdir

- name: install sass gem for Symfony project
  gem:
    name=sass
    user_install=no
    state=present

- name: install NPM packages for Symfony project
  npm:
    path="{{ home }}/site"
    state=present
    global=yes

- name: check for Korobi database
  command: echo "show dbs" | mongo
  changed_when: false
  register: db_result

- name: provision MongoDB for Symfony project
  command: php {{ home }}/site/app/console korobi:db:provision
  when: db_result.stdout.find('korobi') == -1

---
- name: copy parameters.yml template for Symfony project
  template:
    src=symfony_parameters.yml
    dest="{{ home }}/site/app/config/parameters.yml"

- name: check vendor/ for Symfony project
  stat: path="{{ home }}/site/vendor/"
  changed_when: false
  register: vendor

- name: Composer install for Symfony project
  composer:
    command=install
    working_dir="{{ home }}/site"
    prefer_dist=yes
    no_dev=no
  # warnings about an outdated composer.lock file might be sent to stderr, which makes Ansible think the task failed... it didn't, so we'll ignore errors
  ignore_errors: yes
  when: not vendor.stat.exists or not vendor.stat.isdir

- name: install sass gem for Symfony project
  gem:
    name=sass
    user_install=no
    state=present

- name: install NPM packages for Symfony project
  npm:
    name={{ item.name }}
    version={{ item.version }}
    path="{{ home }}/site"
    state=present
    global=yes
  with_items:
    - { name: uglify-js, version: ^2.4.24 }

- name: check for Korobi database
  command: echo "show dbs" | mongo
  changed_when: false
  register: db_result

- name: provision MongoDB for Symfony project
  command: php {{ home }}/site/app/console korobi:db:provision
  when: db_result.stdout.find('korobi') == -1

Fix possible NPM out-of-memory issue
Fix possible NPM out-of-memory issue
