- name: Check and install prerequisites ansible.builtin.apt: name: "{{ item }}" state: latest update_cache: yes install_recommends: no with_items: - ca-certificates - curl - gnupg - lsb-release - name: Add Docker repository block: - name: Make APT keyrings dir ansible.builtin.file: path: /etc/apt/keyrings state: directory owner: root group: root mode: 0755 - name: Add Docker APT key ansible.builtin.get_url: url: "https://download.docker.com/linux/debian/gpg" dest: /etc/apt/keyrings/docker.asc - name: Add Docker APT list ansible.builtin.apt_repository: repo: "deb [arch={{ architectures[ansible_architecture] }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable" filename: docker state: present - name: Install Docker Engine ansible.builtin.apt: name: "{{ item }}" state: latest update_cache: yes install_recommends: no with_items: - docker-ce - docker-ce-cli - containerd.io - docker-buildx-plugin - docker-compose-plugin notify: Autoremove and autoclean packages