---
- name: Add the docker apt signing key
  apt_key:
    url: 'https://download.docker.com/linux/ubuntu/gpg'
    state: present

- name: Add the official docker repo
  apt_repository:
    repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu trusty stable
    state: present

- name: Refresh apt cache
  apt:
    update_cache: true

- name: Install docker
  apt:
    name: 'docker-ce'
    state: 'latest'

- name: Start the docker service
  service:
    name: 'docker'
    state: 'started'
    enabled: 'yes'

---
- name: Add the docker apt signing key
  apt_key:
    url: 'https://download.docker.com/linux/ubuntu/gpg'
    state: present

- name: Add the official docker repo
  apt_repository:
    repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable
    state: present

- name: Refresh apt cache
  apt:
    update_cache: true

- name: Install docker
  apt:
    name: 'docker-ce'
    state: 'latest'

- name: Start the docker service
  service:
    name: 'docker'
    state: 'started'
    enabled: 'yes'

Use correct distribution of docker repo
Use correct distribution of docker repo

When adding the docker apt repo, use the correct distribution based on
the installed release of the builder host.
