--- - name: Manage APT Repositories hosts: all # - harbor.guaranteedstruggle.host # - ansible-slut.guaranteedstruggle.host become: true # Required for managing system-level configurations tasks: - name: Очистить старый классический sources.list ansible.builtin.copy: content: "# Управляется Ansible: репозитории перенесены в sources.list.d/debian.sources\n" dest: /etc/apt/sources.list owner: root group: root mode: '0644' # Шаг 2: Удаляем старый debian.sources если он создавался дефолтным шаблоном LXC с неполными компонентами - name: Удалить дефолтный debian.sources для перезаписи ansible.builtin.file: path: /etc/apt/sources.list.d/debian.sources state: absent # Шаг 3: Накатываем наш единый и правильный DEB822 шаблон - name: Создать унифицированный debian.sources с проксированием через Nexus ansible.builtin.template: src: "../templates/apt-repos/debian.sources.j2" dest: /etc/apt/sources.list.d/debian.sources owner: root group: root mode: '0644' - name: Ensure apt cache is updated after changes ansible.builtin.apt: update_cache: yes - name: Унификация репозиториев Proxmox под DEB822 и Nexus hosts: proxmoxes become: true vars: nexus_url: "https://nexus.guaranteeedstrugglee.host" tasks: # Шаг 1: Вычищаем старые файлы .list, чтобы APT не ругался на дублирование пакетов - name: Удалить старые файлы конфигурации репозиториев Proxmox ansible.builtin.file: path: "/etc/apt/sources.list.d/{{ item }}" state: absent loop: - ceph.list - pve-enterprise.list - pve-install-repo.list - pvetest-for-beta.list # Шаг 2: Накатываем один красивый и современный файл в формате DEB822 - name: Создать унифицированный proxmox.sources с проксированием через Nexus ansible.builtin.template: src: "../templates/apt-repos/proxmox.sources.j2" dest: /etc/apt/sources.list.d/proxmox.sources owner: root group: root mode: '0644' # Шаг 3: Обновляем кэш apt для проверки связки с Нексусом - name: Обновить apt кэш ansible.builtin.apt: update_cache: yes