---
- name: install taps
  homebrew_tap: tap={{ item }} state=present
  with_items:
    - homebrew/dupes
    - homebrew/homebrew-php
    - homebrew/versions

- name: install brews
  homebrew: name={{ item }} state=present
  ignore_errors: yes
  with_items:
    - composer
    - php56
    - php56-intl
    - php56-xdebug
  notify: restart apache

- name: configure Apache
  template: src=templates/apache/httpd.conf.j2 dest=/etc/apache2/other/httpd.conf
  become: yes
  notify: restart apache

- name: enable PHP in Apache
  template: src=templates/apache/php.conf.j2 dest=/etc/apache2/other/php.conf
  become: yes
  notify: restart apache

- name: configure Virtualhosts in Apache
  template: src=templates/apache/vhosts.conf.j2 dest=/etc/apache2/other/vhosts.conf
  become: yes
  notify: restart apache

- name: configure PHP
  template: src=templates/php/php.ini.j2 dest=/usr/local/etc/php/7.0/conf.d/php.ini
  become: yes
  notify: restart apache

- name: update /etc/hosts
  lineinfile: dest=/etc/hosts regexp='.*{{ item.servername }}$' line='127.0.0.1 {{ item.servername }}' state=present
  with_items: '{{ virtualhosts }}'
  become: yes

---
- name: install taps
  homebrew_tap: tap={{ item }} state=present
  with_items:
    - homebrew/dupes
    - homebrew/homebrew-php
    - homebrew/versions

- name: install brews
  homebrew: name={{ item }} state=present
  ignore_errors: yes
  with_items:
    - php56
    - php56-intl
    - php56-xdebug
    - composer
  notify: restart apache

- name: configure Apache
  template: src=templates/apache/httpd.conf.j2 dest=/etc/apache2/other/httpd.conf
  become: yes
  notify: restart apache

- name: enable PHP in Apache
  template: src=templates/apache/php.conf.j2 dest=/etc/apache2/other/php.conf
  become: yes
  notify: restart apache

- name: configure Virtualhosts in Apache
  template: src=templates/apache/vhosts.conf.j2 dest=/etc/apache2/other/vhosts.conf
  become: yes
  notify: restart apache

- name: configure PHP
  template: src=templates/php/php.ini.j2 dest=/usr/local/etc/php/7.0/conf.d/php.ini
  become: yes
  notify: restart apache

- name: update /etc/hosts
  lineinfile: dest=/etc/hosts regexp='.*{{ item.servername }}$' line='127.0.0.1 {{ item.servername }}' state=present
  with_items: '{{ virtualhosts }}'
  become: yes

Install Composer after PHP 5.6
Install Composer after PHP 5.6
