- name: Import GPG key
  rpm_key:
    key: https://download.docker.com/linux/fedora/gpg
    state: present

- name: Add repository
  yum_repository:
    file: docker-ce
    name: docker-ce-stable
    description: Docker CE Stable - $basearch
    baseurl: https://download.docker.com/linux/fedora/$releasever/$basearch/stable
    enabled: yes
    gpgcheck: yes

- name: Update cache
  command: dnf makecache
  args:
    warn: no

- name: Install docker
  dnf:
    name: "{{ docker_packages }}"
    state: present
    enablerepo: docker-ce-test
  notify: cleanup docker
