---

- name: install linux-image-extra-* packages to enable AuFS driver
  apt:
    pkg: "{{item}}"
    state: present
    update_cache: yes
  with_items:
    - linux-image-extra-{{ansible_kernel}}
    - linux-image-extra-virtual

- name: install packages to allow apt to use a repository over HTTPS
  apt:
    pkg: "{{item}}"
    state: present
    update_cache: yes
  with_items:
    - apt-transport-https
    - ca-certificates
    - curl
    - software-properties-common

- name: add docker repository key
  shell: "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -"

- name: set up the stable repository
  shell: "add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu  $(lsb_release -cs) stable\""

- name: install docker
  apt:
    pkg: "{{item}}"
    state: present
    update_cache: yes
  with_items:
    - docker-ce

- name: grant user access to run docker
  command: usermod -aG docker {{whoami}}

---

- name: install linux-image-extra-* packages to enable AuFS driver
  apt:
    pkg: "{{item}}"
    state: present
    update_cache: yes
  with_items:
    - linux-image-extra-{{ansible_kernel}}
    - linux-image-extra-virtual

- name: install packages to allow apt to use a repository over HTTPS
  apt:
    pkg: "{{item}}"
    state: present
    update_cache: yes
  with_items:
    - apt-transport-https
    - ca-certificates
    - curl
    - software-properties-common

- name: add docker repository key
  shell: "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -"

- name: set up the stable repository
  shell: "add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu  $(lsb_release -cs) stable\""

- name: install docker
  apt:
    pkg: "{{item}}"
    state: present
    update_cache: yes
  with_items:
    - docker-ce

- name: grant user access to run docker
  command: usermod -aG docker {{whoami}}

- name: install docker-compose
  pip:
    name: docker-compose
    state: present

Install docker-compose via pip for ubuntu
Install docker-compose via pip for ubuntu
