---
- name: digga init
  hosts: digga
  user: ubuntu
  tasks:
   - name: apt update && upgrade
     apt: update_cache=yes upgrade=full
     sudo: yes

   - name: apt bfgminer
     apt: pkg={{ item }} state=present
     sudo: yes
     with_items:
      - htop
      - git
      - autoconf 
      - libtool 
      - libncurses-dev 
      - yasm 
      - curl 
      - libcurl4-openssl-dev 
      - libjansson-dev 
      - pkg-config 
      - libudev-dev 
      - libusb-dev 
      - uthash-dev 
      - libsensors4-dev 
      - libmicrohttpd-dev 
      - libevent-dev 
      - libusb-1.0-0-dev

   - name: git clone bfgminer 
     git: repo=https://github.com/luke-jr/bfgminer
          dest=/home/ubuntu/bfgminer

   - name: build bfgminer
     shell: "{{ item }} chdir=/home/ubuntu/bfgminer"
     with_items:
       - ./autogen.sh
       - ./configure
       - make
