--- - name: Install aptitude ansible.builtin.apt: name: aptitude state: latest update_cache: true - name: Install required system packages ansible.builtin.apt: pkg: - apt-transport-https - ca-certificates - curl - gnupg - lsb-release - python3-pip - virtualenv - python3-setuptools state: latest update_cache: true - name: Download Docker GPG key ansible.builtin.get_url: url: https://download.docker.com/linux/debian/gpg dest: /etc/apt/keyrings/docker.gpg mode: '0644' - name: Add Docker GPG key to apt keyring ansible.builtin.shell: | gpg --dearmor < /etc/apt/keyrings/docker.gpg > /etc/apt/keyrings/docker.gpg.gpg chmod 644 /etc/apt/keyrings/docker.gpg.gpg args: creates: /etc/apt/keyrings/docker.gpg.gpg - name: Add Docker Repository ansible.builtin.apt_repository: repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg.gpg] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable" state: present filename: docker - name: Update apt and install docker-ce ansible.builtin.apt: name: docker-ce state: latest update_cache: true - name: Install Docker Module for Python ansible.builtin.pip: name: docker extra_args: --break-system-packages - name: adding existing user to group docker '{{ ansible_user }}' ansible.builtin.user: name: '{{ ansible_user }}' groups: docker append: true - name: Ensure Docker service is started and enabled ansible.builtin.service: name: docker state: started enabled: true - name: Ensure Docker Compose plugin is installed ansible.builtin.apt: name: docker-compose-plugin state: latest update_cache: true