---
- name: Install required packages
  apt: pkg={{ item }} update_cache=yes
  sudo: yes
  with_items:
    - apache2
    - libapache2-mod-php5
    - php5
    - php5-dev
    - php5-mysql
    - php-apc
    - php5-xdebug
    - php5-curl
    - php5-json
    - php-pear
    - sendmail

- name: Create the php.ini file
  template: src=php.ini.j2 dest=/etc/php5/apache2/php.ini owner=root group=root mode=0644
  notify: Restart Apache

- name: Enable rewrite module
  sudo: yes
  command: a2enmod rewrite expires

- name: Create the logging directory
  file: path={{ item }} owner=www-data group=www-data state=directory
  sudo: yes
  with_items:
      - /var/log/zidisha.local
      - /var/log/zidisha.local/app_logs
      - /var/log/zidisha.local/apache2


- name: Copy the virtualhost to the sites-available directory
  sudo: yes
  template: src=zidisha.local.conf.j2 dest=/etc/apache2/sites-available/zidisha.local.conf

- name: Enable the virtualhost
  sudo: yes
  command: a2ensite zidisha.local.conf
  notify: Restart Apache

---
- name: Install required packages
  apt: pkg={{ item }} update_cache=yes
  sudo: yes
  with_items:
    - apache2
    - libapache2-mod-php5
    - php5
    - php5-dev
    - php5-mysql
    - php-apc
    - php5-xdebug
    - php5-curl
    - php5-json
    - php-pear
    - sendmail

- name: Create the php.ini file
  sudo: yes
  template: src=php.ini.j2 dest=/etc/php5/apache2/php.ini owner=root group=root mode=0644
  notify: Restart Apache

- name: Enable rewrite module
  sudo: yes
  command: a2enmod rewrite expires

- name: Create the logging directory
  file: path={{ item }} owner=www-data group=www-data state=directory
  sudo: yes
  with_items:
      - /var/log/zidisha.local
      - /var/log/zidisha.local/app_logs
      - /var/log/zidisha.local/apache2


- name: Copy the virtualhost to the sites-available directory
  sudo: yes
  template: src=zidisha.local.conf.j2 dest=/etc/apache2/sites-available/zidisha.local.conf

- name: Enable the virtualhost
  sudo: yes
  command: a2ensite zidisha.local.conf
  notify: Restart Apache

Copy the php.ini template as sudo.
Copy the php.ini template as sudo.
