- name: Install required apt packages for Docker apt: pkg: - apt-transport-https - ca-certificates - curl - software-properties-common - python3-pip - virtualenv - python3-setuptools update_cache: true - name: Add Docker GPG apt Key apt_key: url: 'https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg' state: present - name: Add Docker Repository apt_repository: repo: 'deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable' state: present - name: Install Docker apt: pkg: - docker-ce - docker-ce-cli - containerd.io - docker-compose-plugin update_cache: true - name: Install Docker Module for Python pip: name: - docker - docker-compose - name: Check if Docker is up and running service: name: docker state: started enabled: true