---

## 
## Install base configuration for all servers 
##
- name: Install the minimum Ansible + Linux configuration
  hosts: all
  remote_user: root # It's important here

  roles:
    - base
    - terminal

## 
## Install webserver configuration
##
- name: Install the base config for serving content
  hosts: front-servers
  remote_user: "{{user}}"
  sudo: yes

  roles:
    - backup
    - nginx
    - supervisor
    - hhvm
    - node
    - maria_db
# Other available roles :
#   - mongo

  tasks:
    - name: Ensure the web folder is here
      file:
        path: "/home/{{user}}/www"
        state: directory
        group: www-data

## 
## Install deployment server configuration
##
- name: Install the base config for deployment
  hosts: deploy-servers
  remote_user: "{{user}}"
  sudo: yes

  roles:
    - php-cli
    - git
    - ruby
    - node
    - brad

  tasks:
    - name: Ensure the deploy folder is here
      file:
        path: "/home/{{user}}/deploy"
        state: directory
    - name: Ensure the release folder is here
      file:
        path: "/home/{{user}}/release"
        state: directory

---

## 
## Install base configuration for all servers 
##
- name: Install the minimum Ansible + Linux configuration
  hosts: all
  remote_user: root # It's important here

  roles:
    - base
    - terminal

## 
## Install webserver configuration
##
- name: Install the base config for serving content
  hosts: front-servers
  remote_user: "{{user}}"
  sudo: yes

  roles:
    - nginx
    - supervisor
    - hhvm
    - node
    - maria_db
    - backup
# Other available roles :
#   - mongo

  tasks:
    - name: Ensure the web folder is here
      file:
        path: "/home/{{user}}/www"
        state: directory
        group: www-data
        owner: "{{user}}"
    - name: Remove the temp password for more security
      file:
        path: "/home/{{user}}/www"
        state: directory
        group: www-data
        owner: "{{user}}"
## 
## Install deployment server configuration
##
- name: Install the base config for deployment
  hosts: deploy-servers
  remote_user: "{{user}}"
  sudo: yes

  roles:
    - php-cli
    - git
    - ruby
    - node
    - brad

  tasks:
    - name: Ensure the deploy folder is here
      file:
        path: "/home/{{user}}/deploy"
        state: directory
        owner: "{{user}}"
        group: www-data
    - name: Ensure the release folder is here
      file:
        path: "/home/{{user}}/release"
        state: directory
        owner: "{{user}}"
        group: www-data

## 
## Cleans up
##
- name: Cleans up password files
  hosts: 127.0.0.1
  connection: local

  tasks:
    - name: Delete tmp mysql password
      file:
        path: "/tmp/mysqlpassword"
        state: absent





Add owner for files Add cleans up at the end Inverts backup and DB roles
Add owner for files
Add cleans up at the end
Inverts backup and DB roles
