---
- hosts: gbm-server
  remote_user: root
  become: yes
  become_method: su
  become_user: gbm

  tasks:
    # download the application
    - name: clone git repository
      git:
        repo: https://github.com/devinit/grand-bargain-monitoring.git
        dest: /var/www/grand-bargain-monitoring
        update: yes
        version: dev

    # create directory to store remote data in
    - name: create remote data directory
      file:
        path: /var/www/grand-bargain-monitoring/data/remote
        state: directory

    # install requirements
    - name: install pip requirements
      pip:
        requirements: /var/www/grand-bargain-monitoring/requirements.txt
        virtualenv: /var/www/grand-bargain-monitoring/pyenv
        virtualenv_python: python3
        virtualenv_site_packages: no

    # copy apache config file to correct location

    # create remote data directory

    # download remote data

    # set up cron job to update remote data on regular basis

    # clone, set-up and configure IATI-Stats fork

    # clone, set-up and configure IATI-Dashboard fork

    # run the app

---
- hosts: gbm-server
  remote_user: root
  become: yes
  become_method: su
  become_user: gbm

  tasks:
    # download the application
    - name: clone git repository
      git:
        repo: https://github.com/devinit/grand-bargain-monitoring.git
        dest: /var/www/grand-bargain-monitoring
        update: yes
        version: dev

    # create directory to store remote data in
    - name: create remote data directory
      file:
        path: /var/www/grand-bargain-monitoring/data/remote
        state: directory

    # install requirements
    - name: install pip requirements
      pip:
        requirements: /var/www/grand-bargain-monitoring/requirements.txt
        virtualenv: /var/www/grand-bargain-monitoring/pyenv
        virtualenv_python: python3
        virtualenv_site_packages: no

    # copy apache config file to correct location
    - name: copy apache2 config file
      copy:
        src: /var/www/grand-bargain-monitoring/deployment/apache2.conf
        dest: /etc/apache2/sites-available/000-default.conf
        owner: root
        group: root
        mode: 0644

    # download remote data

    # set up cron job to update remote data on regular basis

    # clone, set-up and configure IATI-Stats fork

    # clone, set-up and configure IATI-Dashboard fork

    # run the app

Copy apache2 config file to correct location
Copy apache2 config file to correct location
