---
- name: Set up docker stable repository on CentOS
  yum_repository:
    name: docker-ce-stable
    description: Docker CE Stable - $basearch
    baseurl: https://download.docker.com/linux/centos/7/$basearch/stable
    enabled: yes
    gpgcheck: yes
    gpgkey: https://download.docker.com/linux/centos/gpg

- name: Install docker-ce
  #   yum:
  #     name: docker-ce-17.03.2.ce
  #     state: present
  #     update_cache: yes
  # NOTE(huntxu): This workaround is required for docker-ce-17.03.2 as its
  # dependency docker-ce-selinux is marked as obsolete. Hopefully this can
  # be removed once a newer version of docker can be used.
  shell: yum install -y --setopt=obsoletes=0 \
         docker-ce-17.03.2.ce-1.el7.centos \
         docker-ce-selinux-17.03.2.ce-1.el7.centos

- name: Start docker service
  systemd:
    name: docker
    state: started
