---
- name: Ensure hhvm GPG key is present
  apt_key:
    url: http://dl.hhvm.com/conf/hhvm.gpg.key
- name: Add repository
  apt_repository:
    repo: 'deb http://dl.hhvm.com/debian wheezy main'
    state: present
  notify:
  - Update apt
- name: Install HHVM
  apt: 
    name: hhvm
    state: latest
- name: Ensure the /var/www folder is here
  file:
    path: /var/www
    state: directory
- name: Install Supervisor conf for HHVM
  copy:
    src: hhvm.supervisor.conf
    dest: /etc/supervisor/conf.d/hhvm.conf
    backup: yes
  notify:
  - Reread supervisor conf
- name: Ensure the global config is ok
  copy:
    src: config.hdf
    dest: /etc/hhvm/config.hdf
- name: Ensure the server config is ok
  copy:
    src: server.hdf
    dest: /etc/hhvm/server.hdf
- name: Ensure the www directory is correctly written in the conf
  lineinfile:
    dest: /etc/hhvm/server.hdf
    insertafter: "  # SourceRoot = /home/myUser/www/"
    line: "  SourceRoot = /home/{{user}}/www/"
- name: Install Nginx conf for HHVM
  copy:
    src: hhvm.nginx.conf
    dest: /etc/nginx/hhvm.conf
  notify:
  - Restart Nginx
- name: Ensure HHVM is running
  supervisorctl:
    name: hhvm
    state: started
---
- name: Ensure hhvm GPG key is present
  apt_key:
    url: http://dl.hhvm.com/conf/hhvm.gpg.key
- name: Add repository
  apt_repository:
    repo: 'deb http://dl.hhvm.com/debian wheezy main'
    state: present
  notify:
  - Update apt
- name: Install libmemcachedutil2
  apt: 
    name: libmemcachedutil2
    state: latest
- name: Install HHVM
  apt: 
    name: hhvm
    state: latest
- name: Ensure the /var/www folder is here
  file:
    path: /var/www
    state: directory
- name: Install Supervisor conf for HHVM
  copy:
    src: hhvm.supervisor.conf
    dest: /etc/supervisor/conf.d/hhvm.conf
    backup: yes
  notify:
  - Reread supervisor conf
- name: Ensure the global config is ok
  copy:
    src: config.hdf
    dest: /etc/hhvm/config.hdf
- name: Ensure the server config is ok
  copy:
    src: server.hdf
    dest: /etc/hhvm/server.hdf
- name: Ensure the www directory is correctly written in the conf
  lineinfile:
    dest: /etc/hhvm/server.hdf
    insertafter: "  # SourceRoot = /home/myUser/www/"
    line: "  SourceRoot = /home/{{user}}/www/"
- name: Install Nginx conf for HHVM
  copy:
    src: hhvm.nginx.conf
    dest: /etc/nginx/hhvm.conf
  notify:
  - Restart Nginx
- name: Ensure HHVM is running
  supervisorctl:
    name: hhvm
    state: started
Add a required dependancy for HHVM
Add a required dependancy for HHVM
