- name: Setup Basic Debian Host Machine hosts: "{{ target }}" become: yes tasks: - name: Update Apt Cache and Upgrade all Packages register: updatesys apt: name: "*" state: latest update_cache: yes cache_valid_time: 3600 #1 hour become: yes - name: Display the last line of the previous task to check the stats debug: msg: "{{updatesys.stdout_lines|last}}" - name: Install First Basic Packages apt: name: - git - tree - vim - rsync - ca-certificates - curl - gnupg - python3-pip become: yes - name: Adding Docker's GPG key and Setup the apt repository for Debian ansible.builtin.shell: | install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg chmod a+r /etc/apt/keyrings/docker.gpg echo \ "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ tee /etc/apt/sources.list.d/docker.list > /dev/null become: yes - name: Update the apt Cache with the new Docker repository apt: update_cache: yes become: yes - name: Install Docker Engine apt: name: - docker-ce - docker-ce-cli - containerd.io - docker-compose-plugin become: yes - name: Install docker-compose with pip3 ansible.builtin.pip: name: docker-compose state: latest become: yes - name: Adding user {{user_name}} to the docker group ansible.builtin.shell: | groupadd docker usermod -aG docker {{user_name}} become: yes