This commit is contained in:
69
playbooks/apt-repositories.yml
Normal file
69
playbooks/apt-repositories.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
---
|
||||
- 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
|
||||
Reference in New Issue
Block a user