- hosts: all become: yes tasks: - name: add the package repository key apt_key: url: https://download.docker.com/linux/ubuntu/gpg state: present - name: add the package repository apt_repository: repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable state: present filename: docker - name: install Docker apt: name: "{{ item }}" update_cache: yes with_items: - docker-ce - docker-ce-cli - containerd.io - docker-compose