#- name: Check if docker is already installed # stat: # path: /usr/bin/docker # register: docker_file - name: Install Packages # when: docker_file.stat.exists == False package: name: - gpg - gpg-agent - name: Add docker-key apt_key: url: https://download.docker.com/linux/debian/gpg state: present - name: Add docker-repository apt_repository: repo: "deb https://download.docker.com/linux/{{ ansible_facts.distribution | lower }} {{ ansible_facts.distribution_release }} stable" state: present filename: docker update_cache: yes - name: Install docker package: name: - docker-ce - docker-ce-cli - containerd.io - docker-compose-plugin - pass state: latest - name: Deploy docker-compose command to new docker compose plugin ansible.builtin.copy: src: docker-compose dest: "/usr/local/bin/docker-compose" mode: preserve