--- - name: Install required system packages ansible.builtin.apt: name: - apt-transport-https - ca-certificates - curl - software-properties-common - python3-pip - virtualenv - python3-setuptools state: latest update_cache: true - name: Create keyring directory ansible.builtin.file: dest: /etc/apt/keyrings state: directory - name: Add signing key ansible.builtin.get_url: url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg" dest: /etc/apt/keyrings/docker.gpg_armored - name: De-Armor Docker GPG key shell: > gpg --dearmor < /etc/apt/keyrings/docker.gpg_armored > /etc/apt/keyrings/docker.gpg # no_log: true args: creates: /etc/apt/keyrings/docker.gpg - name: Get DEB architecture shell: dpkg --print-architecture register: deb_architecture changed_when: 'False' - name: Add repository into sources list ansible.builtin.apt_repository: repo: "deb [arch={{ deb_architecture.stdout }} signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable" state: present filename: docker - name: Install Docker ansible.builtin.apt: name: - docker-ce - docker-ce-cli - containerd.io - docker-compose-plugin - docker-compose state: latest update_cache: true - name: Install Docker Module for Python pip: name: docker - name: adding existing user vagrant to group docker user: name: vagrant groups: docker append: 'yes' #