Files
ansible-repo/playbooks/software/docker.yml
hogweed1 05b7decce3
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
docker-ansi
2026-05-16 00:41:05 +10:00

45 lines
1.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: Migrate Docker repository to modern DEB822 standard
hosts: docker
become: true
tasks:
# 1. Зачищаем старые следы (legacy-дефолт)
- name: Remove legacy Docker apt source list if exists
ansible.builtin.file:
path: /etc/apt/sources.list.d/docker.list
state: absent
- name: Remove legacy Docker GPG key from trusted.gpg.d
ansible.builtin.file:
path: /etc/apt/trusted.gpg.d/docker.gpg
state: absent
# 2. Разворачиваем репозиторий по "актуальной мете"
- name: Setup Docker CE repository using deb822 format
ansible.builtin.deb822_repository:
name: docker
types: deb
uris: https://download.docker.com/linux/debian
# ansible_distribution_release автоматически подставит имя дистрибутива (например, bookworm или trixie)
suites: "{{ ansible_distribution_release }}"
components: stable
# Ansible сам скачает текстовый ключ, дебронирует его в бинарный
# и сохранит по канону в /etc/apt/keyrings/docker.gpg
signed_by: https://download.docker.com/linux/debian/gpg
register: docker_repo_added
# 3. Обновляем кэш пакетов только при изменениях
- name: Run apt update
ansible.builtin.apt:
update_cache: true
when: docker_repo_added.changed
- name: Install the packages versions
ansible.builtin.package:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin