---
- name: update repos
  sudo: true
  apt: update_cache=yes

- name: install apache
  sudo: true 
  apt: pkg=apache2 state=latest
  notify:
    - apache-restart

#- name: install apache php-fpm
#  sudo: true 
#  apt: pkg=apache2-mpm-event state=latest
#  notify:
#    - apache-restart

# Adding Proper Repositories
- name: add proper repo for php fpm
  sudo: true
  apt_repository: repo='deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse' state=present
- name: add proper repo for php fpm
  sudo: true
  apt_repository: repo='deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse' state=present
- name: add proper repo for php fpm
  sudo: true
  apt_repository: repo='deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse' state=present
- name: add proper repo for php fpm
  sudo: true
  apt_repository: repo='deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse' state=present

- name: update repos
  sudo: true
  apt: update_cache=yes
# End adding Repos

- name: install apache php-fpm
  sudo: true 
  apt: pkg=libapache2-mod-fastcgi state=latest
  notify:
    - apache-restart

- name: add apache php-fpm
  template: src=php5-fpm.conf.j2 dest=/etc/apache2/conf-available/php5-fpm.conf owner=root mode=0600
  notify:
    - apache-restart

- name: Enable required apache modules
  command: a2enmod actions fastcgi alias proxy proxy_ajp proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_fcgi proxy_html xml2enc

- name: Enable required apache config
  command: a2enconf php5-fpm
  notify:
    - apache-restart
- name: enabled mod_proxy
  apache2_module: name=proxy state=present
  
- name: enabled mod_proxy
  apache2_module: name=proxy state=present
  
- name: enabled mod_rewrite
  apache2_module: name=rewrite state=present
  notify:
    - apache-restart

- include: vhost.yml
- include: auth.yml
