This commit is contained in:
@@ -6,71 +6,62 @@
|
||||
become: true # Required for managing system-level configurations
|
||||
|
||||
tasks:
|
||||
#### TODO добавить указание что всё управляется ансиболью
|
||||
- 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'
|
||||
|
||||
#### TODO разобраться вподвидах репозиториев, почему оно необъектное??
|
||||
# Шаг 2: Удаляем старый debian.sources если он создавался дефолтным шаблоном LXC с неполными компонентами
|
||||
- name: Удалить дефолтный debian.sources для перезаписи
|
||||
ansible.builtin.file:
|
||||
path: /etc/apt/sources.list.d/debian.sources
|
||||
state: absent
|
||||
|
||||
#### TODO WUT :: чому нормально не раскидывается в контейнере?
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb https://nexus.guaranteedstruggle.host/repository/generic-deb-debian-org/ {{ ansible_distribution_release }} main non-free-firmware' # Replace with your desired repository
|
||||
state: present
|
||||
#filename: /etc/apt/sources.list
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb-src https://nexus.guaranteedstruggle.host/repository/generic-deb-debian-org/ {{ ansible_distribution_release }} main non-free-firmware' # Replace with your desired repository
|
||||
state: present
|
||||
#filename: /etc/apt/sources.list
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb http://deb.debian.org/debian/ {{ ansible_distribution_release }} main non-free-firmware' # Replace with your desired repository
|
||||
state: absent
|
||||
#filename: /etc/apt/sources.list
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb-src http://deb.debian.org/debian/ {{ ansible_distribution_release }} main non-free-firmware' # Replace with your desired repository
|
||||
state: absent
|
||||
#filename: /etc/apt/sources.list
|
||||
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb https://nexus.guaranteedstruggle.host/repository/generic-security-debian/ {{ ansible_distribution_release }}-security main non-free-firmware' # Replace with your desired repository
|
||||
state: present
|
||||
#filename: /etc/apt/sources.list
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb-src https://nexus.guaranteedstruggle.host/repository/generic-security-debian/ {{ ansible_distribution_release }}-security main non-free-firmware' # Replace with your desired repository
|
||||
state: present
|
||||
#filename: /etc/apt/sources.list
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb http://security.debian.org/debian-security {{ ansible_distribution_release }}-security main non-free-firmware' # Replace with your desired repository
|
||||
state: absent
|
||||
#filename: /etc/apt/sources.list
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb-src http://security.debian.org/debian-security {{ ansible_distribution_release }}-security main non-free-firmware' # Replace with your desired repository
|
||||
state: absent
|
||||
#filename: /etc/apt/sources.list
|
||||
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb https://nexus.guaranteedstruggle.host/repository/generic-deb-debian-org/ {{ ansible_distribution_release }}-updates main non-free-firmware' # Replace with your desired repository
|
||||
state: present
|
||||
#filename: /etc/apt/sources.list
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb-src https://nexus.guaranteedstruggle.host/repository/generic-deb-debian-org/ {{ ansible_distribution_release }}-updates main non-free-firmware' # Replace with your desired repository
|
||||
state: present
|
||||
#filename: /etc/apt/sources.list
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb http://deb.debian.org/debian/ {{ ansible_distribution_release }}-updates main non-free-firmware' # Replace with your desired repository
|
||||
state: absent
|
||||
#filename: /etc/apt/sources.list
|
||||
- ansible.builtin.apt_repository:
|
||||
repo: 'deb-src http://deb.debian.org/debian/ {{ ansible_distribution_release }}-updates main non-free-firmware' # Replace with your desired repository
|
||||
state: absent
|
||||
#filename: /etc/apt/sources.list
|
||||
|
||||
|
||||
# - name: Disable an existing APT repository (by commenting out its entry)
|
||||
# ansible.builtin.lineinfile:
|
||||
# path: /etc/apt/sources.list # Replace with the path to the .list file of the repository to disable
|
||||
# regexp: '^(http://security.debian.org/debian-security .*)$' # Matches lines starting with 'deb '
|
||||
# line: '# \g<1>' # Comments out the matched line
|
||||
# backrefs: true # Required to use backreferences in the 'line' parameter
|
||||
# state: present # Ensure the line is present (commented out)
|
||||
# Шаг 3: Накатываем наш единый и правильный DEB822 шаблон
|
||||
- name: Создать унифицированный debian.sources с проксированием через Nexus
|
||||
ansible.builtin.template:
|
||||
src: "../templates/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/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
|
||||
11
templates/apt-repos/debian.sources.j2
Normal file
11
templates/apt-repos/debian.sources.j2
Normal file
@@ -0,0 +1,11 @@
|
||||
Types: deb deb-src
|
||||
URIs: {{ nexus_url }}/repository/generic-deb-debian-org/
|
||||
Suites: {{ ansible_distribution_release }} {{ ansible_distribution_release }}-updates
|
||||
Components: main contrib non-free-firmware
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
|
||||
Types: deb deb-src
|
||||
URIs: {{ nexus_url }}/repository/generic-security-debian/
|
||||
Suites: {{ ansible_distribution_release }}-security
|
||||
Components: main contrib non-free-firmware
|
||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||
13
templates/apt-repos/proxmox.sources.j2
Normal file
13
templates/apt-repos/proxmox.sources.j2
Normal file
@@ -0,0 +1,13 @@
|
||||
# Репозиторий Proxmox VE No-Subscription проксируемый через Nexus
|
||||
Types: deb
|
||||
URIs: {{ nexus_url }}/repository/proxmox-proxy/debian/pve
|
||||
Suites: {{ ansible_distribution_release }}
|
||||
Components: pve-no-subscription
|
||||
Signed-By: /usr/share/keyrings/proxmox-release-{{ ansible_distribution_release }}.gpg
|
||||
|
||||
# Репозиторий Ceph Reef проксируемый через Nexus
|
||||
Types: deb
|
||||
URIs: {{ nexus_url }}/repository/proxmox-proxy/debian/ceph-reef
|
||||
Suites: {{ ansible_distribution_release }}
|
||||
Components: no-subscription
|
||||
Signed-By: /usr/share/keyrings/proxmox-release-{{ ansible_distribution_release }}.gpg
|
||||
Reference in New Issue
Block a user