---
- name: "install php"
  apt: name={{ item }} state=present
  with_items: php_apt_packages
  notify:
    - restart webserver

- name: "Install pecl libraries"
  shell: pecl install igbinary

- name: "copy PHP-FPM conf"
  copy: src=fpm/ dest=/etc/php5/fpm/ directory_mode=yes

- name: "service run php5-fpm"
  service: name=php5-fpm state=started enabled=yes

- name: "copy info.php"
  copy: src=info.php dest=/var/www/html/info.php

---
- name: "install php"
  apt: name={{ item }} state=present
  with_items: php_apt_packages
  notify:
    - restart webserver

- name: "Install pecl libraries"
  shell: pecl install igbinary
  register: pecl_result
  changed_when: "'already installed' not in pecl_result.stdout"
  failed_when: "pecl_result.stderr"

- name: "copy PHP-FPM conf"
  copy: src=fpm/ dest=/etc/php5/fpm/ directory_mode=yes

- name: "service run php5-fpm"
  service: name=php5-fpm state=started enabled=yes

- name: "copy info.php"
  copy: src=info.php dest=/var/www/html/info.php

Check for pecl before installing
Check for pecl before installing
