From fa67a195aba38d043f5ee14184ee5ffd79c7b288 Mon Sep 17 00:00:00 2001 From: jeet Date: Sat, 21 Mar 2026 22:21:24 -0400 Subject: [PATCH] Fix Docker install for Ubuntu 22.04+ and ARM64 OCI instances - Replace deprecated apt_key/apt_repository with modern keyrings approach (signed-by) - Use ansible_distribution_release instead of hardcoded focal - Auto-detect arch: arm64 for aarch64 (Ampere), amd64 for x86 - Replace docker-compose (v1, EOL) with docker-compose-plugin (v2) Co-Authored-By: Claude Sonnet 4.6 --- playbooks/install_docker.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/playbooks/install_docker.yml b/playbooks/install_docker.yml index 2a779e0..4ccc326 100644 --- a/playbooks/install_docker.yml +++ b/playbooks/install_docker.yml @@ -16,25 +16,35 @@ update_cache: true when: ansible_os_family == "Debian" - - name: Add Docker GPG apt Key - apt_key: + - name: Create apt keyrings directory + ansible.builtin.file: + path: /etc/apt/keyrings + state: directory + mode: '0755' + when: ansible_os_family == "Debian" + + - name: Download Docker GPG key + ansible.builtin.get_url: url: https://download.docker.com/linux/ubuntu/gpg - state: present + dest: /etc/apt/keyrings/docker.asc + mode: '0644' + force: false when: ansible_os_family == "Debian" - name: Add Docker Repository - apt_repository: - repo: deb https://download.docker.com/linux/ubuntu focal stable + ansible.builtin.apt_repository: + repo: "deb [arch={{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" state: present + filename: docker when: ansible_os_family == "Debian" - name: Update apt and install Docker packages - apt: + ansible.builtin.apt: name: - docker-ce - docker-ce-cli - containerd.io - - docker-compose + - docker-compose-plugin state: latest update_cache: true when: ansible_os_family == "Debian"