fix: separate apt update after adding Docker repo, use variable for repo string

The apt_repository update_cache option wasn't reliably picking up the
new Docker APT repo. Split into separate apt update step. Also moved
the long repo string to a default variable to satisfy yaml line-length
lint rule.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Emil Simeonov
2026-06-20 22:15:28 +02:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent 02909bf8b4
commit 36207be565
2 changed files with 11 additions and 7 deletions
@@ -31,3 +31,7 @@ gitea_runner_file: ".runner"
# Docker installation (for rootless dependencies) # Docker installation (for rootless dependencies)
docker_gpg_key_path: "/etc/apt/keyrings/docker.gpg" docker_gpg_key_path: "/etc/apt/keyrings/docker.gpg"
docker_apt_repo: >-
deb [arch={{ ansible_facts['architecture'] }} signed-by={{ docker_gpg_key_path }}]
https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}
{{ ansible_facts['distribution_release'] }} stable
@@ -9,7 +9,7 @@
- name: Download and dearmor Docker GPG key (Debian/Ubuntu) - name: Download and dearmor Docker GPG key (Debian/Ubuntu)
ansible.builtin.shell: | ansible.builtin.shell: |
set -o pipefail set -o pipefail
curl -fsSL "https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}/gpg" | gpg --dearmor -o {{ docker_gpg_key_path }} curl -fsSL "https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}/gpg" | gpg --dearmor --yes -o {{ docker_gpg_key_path }}
args: args:
creates: "{{ docker_gpg_key_path }}" creates: "{{ docker_gpg_key_path }}"
executable: /bin/bash executable: /bin/bash
@@ -17,12 +17,14 @@
- name: Add Docker APT repository (Debian/Ubuntu) - name: Add Docker APT repository (Debian/Ubuntu)
ansible.builtin.apt_repository: ansible.builtin.apt_repository:
repo: >- repo: "{{ docker_apt_repo }}"
deb [arch={{ ansible_facts['architecture'] }} signed-by={{ docker_gpg_key_path }}]
https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }}
{{ ansible_facts['distribution_release'] }} stable
state: present state: present
when: ansible_facts['os_family'] == 'Debian'
- name: Update apt cache after adding Docker repo (Debian/Ubuntu)
ansible.builtin.apt:
update_cache: true update_cache: true
cache_valid_time: 0
when: ansible_facts['os_family'] == 'Debian' when: ansible_facts['os_family'] == 'Debian'
- name: Install rootless Docker dependencies (Debian/Ubuntu) - name: Install rootless Docker dependencies (Debian/Ubuntu)
@@ -38,8 +40,6 @@
- docker-compose-plugin - docker-compose-plugin
- rsync - rsync
state: present state: present
update_cache: true
cache_valid_time: 0
when: ansible_facts['os_family'] == 'Debian' when: ansible_facts['os_family'] == 'Debian'
- name: Install rootless Docker dependencies (Arch Linux) - name: Install rootless Docker dependencies (Arch Linux)