--- - name: Install Docker requirements apt: name: - apt-transport-https - ca-certificates - curl - gnupg - lsb-release state: present update_cache: yes - name: Add Docker's official GPG key apt_key: url: https://download.docker.com/linux/ubuntu/gpg state: present - name: Add Docker repository apt_repository: repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" state: present - name: Install Docker CE apt: name: - docker-ce - docker-ce-cli - containerd.io - docker-buildx-plugin - docker-compose-plugin state: present update_cache: yes - name: Start and enable Docker service systemd: name: docker state: started enabled: yes - name: Add user to docker group user: name: "{{ ansible_user }}" groups: docker append: yes