---
- hosts: all
  tasks:
  - name: install pre-req
    apt: name="{{ item }}" update_cache=yes state=latest
    with_items: [python, tcsh, expect, jq , bc,  python-pip, python-dev, build-essential, libgeos-dev, nmap, git, screen, parallel, libffi-dev, libssl-dev,software-properties-common]
    become: true
  - {name: pip, pip: name=pyproj,become: yes}
  - {name: pip, pip: name=shapely, become: yes}  
  - {name: pip, pip: name=psutil, become: yes}
  - {name: pip pika, pip: name=pika, become: yes}
  - {name: pip python-dateutil, pip: name=python-dateutil, become: yes}
  - {name: pip pymongo, pip: name=pymongo version=2.7.2, become: yes}
  - {name: pip numpy, pip: name=numpy, become: yes}
  - {name: pip paramiko, pip: name=paramiko, become: yes}
  - {name: mkdir, command: mkfs.ext4 /dev/vdc, become: yes}
  - {name: create mount point data, file: path=/mnt/data/ state=directory owner=vm_user group=vm_user}
  - {name: create mount point source, file: path=/mnt/data/source/ state=directory owner=vm_user group=vm_user}
  - {name: create mount point output, file: path=/mnt/data/source/output state=directory owner=vm_user group=vm_user}
  - {name: mount, command: mount /dev/vdc /mnt/data, become: yes}
  - {name: download dataset, get_url: 'url=ftp://ftp.ifremer.fr/ifremer/coriolis/co0547-bigdata-archive/envriplus_euroargo_bigdata.tar.gz dest=/mnt/data'}
  - {name: untar, unarchive: src=/mnt/data/envriplus_euroargo_bigdata.tar.gz dest=/mnt/data/ remote_src=true}
  - {name: create workspace, file: path=/home/vm_user/workspace state=directory owner=vm_user group=vm_user}  
  - {name: clone repo, git: 'repo=https://github.com/skoulouzis/dockerfiles.git dest=/home/vm_user/workspace/dockerfiles version=HEAD force=yes'}
  - {name: conf script, command: cp /home/vm_user/workspace/dockerfiles/ArgoDiffusion/scripts/ar_bigmetadata.json /mnt/data/source/ar_bigmetadata.json, become: no} 
  - {name: conf ssh cp, command: cp /etc/ssh/sshd_config /tmp, become: yes}  
  - {name: conf ssh chown vm_user, command: chown vm_user /tmp/sshd_config, become: yes}
  - {name: conf ssh echo, command: echo "" >> sshd_config && echo "UseDNS no" >> sshd_config, become: no}
  - {name: conf ssh chown root, command: chown root /tmp/sshd_config, become: yes}
  - {name: conf ssh mv, command: mv /tmp/sshd_config /etc/ssh/, become: yes}    
  - {name: conf ssh restart, command: service ssh restart, become: yes}
  - {name: screen conf, command: echo "logfile /mnt/data/argoBenchmark" > /home/vm_user/.screenrc, become_user: vm_user}
  

  
  
  