Files
ansible-repo/playbooks/apt-repositories.yml
hogweed1 33a7b1db9c
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 0s
well,
2026-11-06 16:57:59 +10:00

69 lines
2.8 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: Manage APT Repositories
hosts: all
# - harbor.guaranteedstruggle.host
# - ansible-slut.guaranteedstruggle.host
become: true # Required for managing system-level configurations
vars:
nexus_url: "https://nexus.guaranteedstruggle.host"
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.guaranteedstruggle.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