---
# This role deploys the mongodb processes and sets up settings.

- name: Mongodb | Add keys authenticity
  apt_key: url={{ url_apt_key }}0x7F0CEB10

- name: Mongodb | Add source sources
  apt_repository: repo='deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' update_cache=yes

- name: Mongodb | Install Packages
  apt: pkg=mongodb-10gen

- name: Mongodb | Install PHP 5 Mongo Module
  command: pecl install mongo
  ignore_errors: true

- name: Mongodb | Configure PHP to use PECL MongoDB extension
  template: src=etc-php5-conf-d-mongo-ini.j2 dest=/etc/php5/mods-available/mongo.ini

- name: Mongodb | Enable extension mongo.ini
  command: php5enmod ALL mongo state=present

---
# This role deploys the mongodb processes and sets up settings.

- name: Mongodb | Add keys authenticity
  apt_key: url={{ url_apt_key }}0x7F0CEB10

- name: Mongodb | Add source sources
  apt_repository: repo='deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' update_cache=yes

- name: Mongodb | Install Packages
  apt: pkg=mongodb-10gen

- name: Mongodb | check if PHP installed
  command: php -m
  register: php_installed
  ignore_errors: true

- name: Mongodb | Install PHP 5 Mongo Module
  command: pecl install mongo
  when: ! php_installed
  register: pecl_result
  changed_when: "'already installed' not in pecl_result.stdout"
  failed_when: "pecl_result.stderr"

- name: Mongodb | Configure PHP to use PECL MongoDB extension
  template: src=etc-php5-conf-d-mongo-ini.j2 dest=/etc/php5/mods-available/mongo.ini
  when: ! php_installed

- name: Mongodb | Enable extension mongo.ini
  command: php5enmod ALL mongo state=present
  when: ! php_installed

Add test if php is installed to install the associated driver
Add test if php is installed to install the associated driver
