--- # ============================================================================= # Gitea Act Runner - Docker Installation # ============================================================================= # # Installs Docker CE following the official Docker documentation: # https://docs.docker.com/engine/install/ubuntu/ # # Uses DEB822 format (.sources) as per current Docker documentation. # # ============================================================================= # Remove old/conflicting Docker packages that may interfere. - name: Remove conflicting Docker packages ansible.builtin.apt: name: - docker.io - docker-doc - docker-compose - docker-compose-v2 - podman-docker - containerd - runc state: absent failed_when: false # Install packages required to add Docker's APT repository. - name: Install Docker prerequisites ansible.builtin.apt: name: - ca-certificates - curl state: present # Create directory for APT keyrings. - name: Create keyrings directory ansible.builtin.file: path: /etc/apt/keyrings state: directory mode: '0755' # Download Docker's official GPG key. - name: Download Docker GPG key ansible.builtin.get_url: url: https://download.docker.com/linux/ubuntu/gpg dest: /etc/apt/keyrings/docker.asc mode: '0644' # Get the dpkg architecture for the repository URL. - name: Get dpkg architecture ansible.builtin.command: dpkg --print-architecture register: act_runner_dpkg_arch changed_when: false # Add Docker's APT repository using DEB822 format. # This is the modern format recommended by Docker documentation. - name: Add Docker APT repository (DEB822 format) ansible.builtin.copy: dest: /etc/apt/sources.list.d/docker.sources mode: '0644' content: | Types: deb URIs: https://download.docker.com/linux/ubuntu Suites: {{ ansible_facts['distribution_release'] }} Components: stable Architectures: {{ act_runner_dpkg_arch.stdout }} Signed-By: /etc/apt/keyrings/docker.asc # Update apt cache after adding repository. - name: Update apt cache ansible.builtin.apt: update_cache: true cache_valid_time: 0 # Force update since we just added a new repo # Install Docker CE and related packages. - name: Install Docker packages ansible.builtin.apt: name: - docker-ce - docker-ce-cli - containerd.io - docker-buildx-plugin - docker-compose-plugin state: present # Ensure Docker service is running and enabled on boot. - name: Ensure Docker service is started and enabled ansible.builtin.systemd: name: docker state: started enabled: true