---
- hosts: vagrant
  sudo: yes
  tasks:
    - name: install essential Python packages
      apt: pkg=$item state=present
      with_items:
        - python-pip
        - python-virtualenv
        - python-software-properties
    - name: add Java PPA
      apt_repository: repo=ppa:webupd8team/java state=present
    - name: ensure recent package list
      apt: update_cache=yes
    - name: automatically accept Java license
      shell: echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
    - name: install Java 7
      apt: pkg=$item state=present
      with_items:
        - oracle-java7-installer
        - oracle-java7-set-default

---
- hosts: vagrant
  sudo: yes
  tasks:
    - name: install essential Python packages
      apt: pkg=$item state=present
      with_items:
        - python-pip
        - python-virtualenv
        - python-software-properties
    - name: add Java PPA
      apt_repository: repo=ppa:webupd8team/java state=present
    - name: ensure recent package list
      apt: update_cache=yes
    - name: automatically accept Java license
      shell: echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
    - name: install Java 7
      apt: pkg=$item state=present
      with_items:
        - oracle-java7-installer
        - oracle-java7-set-default
    - name: fix /etc/hosts
      lineinfile: dest=/etc/hosts regexp='^127\.0\.1\.1\s+(.*)$' line='127.0.0.1 \\1' backrefs=yes state=present

Fix loopback IP as HBase prefers.
Fix loopback IP as HBase prefers.
