---

- name: Update APT package cache
  sudo: yes
  apt: update_cache=yes

- name: Update Linux Kernel
  sudo: yes
  apt: pkg={{item}} state=installed
  with_items:
    - linux-image-generic-lts-raring
    - linux-headers-generic-lts-raring

- name: reboot server
  command: /sbin/reboot 
  sudo: yes

- name: wait for {{ host_ip }} to go down
  connection: local
  wait_for: host={{ host_ip }} port=22 state=stopped 

- name: wait for {{ host_ip }} to come back up
  connection: local
  wait_for: port=22 host={{ host_ip }}

- name: Install docker key
  apt_key: url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xD8576A8BA88D21E9
  sudo: yes

- name: Create docker.list file
  sudo: yes
  file: path=/etc/apt/sources.list.d/docker.list state=touch

- name: Install docker repo
  sudo: yes
  lineinfile: dest=/etc/apt/sources.list.d/docker.list regexp="deb http://get.docker.io" line="deb http://get.docker.io/ubuntu docker main"

- name: Update APT package cache
  sudo: yes
  apt: update_cache=yes

- name: Install docker
  sudo: yes
  apt: pkg=lxc-docker state=installed