---
- name: Add GPG key for Docker packages
  sudo: yes
  apt_key: keyserver=hkp://p80.pool.sks-keyservers.net:80 id=9DC858229FC7DD38854AE2D88D81803C0EBFCD88

- name: add repo for Docker packages
  sudo: yes
  apt_repository:
    repo: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial main'
    state: present
    update_cache: true

- name: Install device-mapper packages
  sudo: yes
  yum:
    name: device-mapper-libs
    state: latest

- name: detect kernel version
  command: uname -r
  register: uname_kernel_version

- name: install docker packages
  sudo: yes
  apt:
    name: "{{ item }}"
    state: present
  with_items:
    - "linux-image-extra-{{uname_kernel_version.stdout}}"
    - linux-image-extra-virtual
    - docker-ce

- name: enable docker
  sudo: yes
  service:
    name: docker
    enabled: yes
    state: started

- name: install latest docker-compose
  sudo: yes
  shell: "curl -L https://github.com/docker/compose/releases/download/{{docker_compose_version}}/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose"

---
- name: Add GPG key for Docker packages
  sudo: yes
  apt_key: keyserver=hkp://p80.pool.sks-keyservers.net:80 id=9DC858229FC7DD38854AE2D88D81803C0EBFCD88

- name: add repo for Docker packages
  sudo: yes
  apt_repository:
    repo: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable'
    state: present
    update_cache: true

- name: detect kernel version
  command: uname -r
  register: uname_kernel_version

- name: install docker packages
  sudo: yes
  apt:
    name: "{{ item }}"
    state: present
  with_items:
    - "linux-image-extra-{{uname_kernel_version.stdout}}"
    - linux-image-extra-virtual
    - docker-ce

- name: enable docker
  sudo: yes
  service:
    name: docker
    enabled: yes
    state: started

- name: install latest docker-compose
  sudo: yes
  shell: "curl -L https://github.com/docker/compose/releases/download/{{docker_compose_version}}/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose"

Fix docker package repo. Also, device-mapper-libs is no longer needed.
Fix docker package repo.
Also, device-mapper-libs is no longer needed.
