Добавлена роль repo для автоматического добавления репозиториев

- Создана новая роль repo для добавления репозиториев на все ОС
- Добавлена поддержка Docker, PostgreSQL, Elasticsearch, Patroni репозиториев
- Реализована специальная поддержка российских дистрибутивов:
  - Astra Linux: добавлены репозитории Lab50 и debian-archive-keyring
  - Alt Linux: добавлены репозитории Sisyphus (alt-sisyphus, classic, contrib) и Autoimports
- Обновлена документация README.md с информацией о новой роли
- Обновлен .ansible-lint для подавления необходимых правил
- Автор: Сергей Антропов, https://devops.org.ru
This commit is contained in:
Сергей Антропов
2025-10-30 03:13:35 +03:00
parent a2316ae780
commit 23e1a6037b
25 changed files with 2495 additions and 1038 deletions

View File

@@ -0,0 +1,96 @@
---
# Задачи для Debian/Ubuntu
# Автор: Сергей Антропов
# Сайт: https://devops.org.ru
- name: Установить необходимые пакеты для работы с репозиториями
ansible.builtin.apt:
name:
- ca-certificates
- curl
- gnupg
- lsb-release
state: present
update_cache: yes
allow_unauthenticated: no
force_apt_get: yes
- name: Создать директорию для GPG ключей
ansible.builtin.file:
path: /usr/share/keyrings
state: directory
mode: '0755'
- name: Получить и добавить Docker GPG ключ
ansible.builtin.shell: |
curl -fsSL {{ docker_gpg_url }} | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
args:
creates: /usr/share/keyrings/docker-archive-keyring.gpg
notify: "update apt cache"
- name: Добавить репозиторий Docker для {{ os_version_id }}
ansible.builtin.apt_repository:
repo: "{{ debian_repos[os_version_id]['docker_repo'] }}"
state: present
filename: docker-ce
when: debian_repos is defined and os_version_id in debian_repos
notify: "update apt cache"
- name: Получить и добавить PostgreSQL GPG ключ
ansible.builtin.shell: |
curl -fsSL {{ postgresql_gpg_url }} | gpg --dearmor -o /usr/share/keyrings/postgresql.gpg
args:
creates: /usr/share/keyrings/postgresql.gpg
notify: "update apt cache"
- name: Добавить репозиторий PostgreSQL для {{ os_version_id }}
ansible.builtin.apt_repository:
repo: "{{ debian_repos[os_version_id]['postgresql_repo'] }}"
state: present
filename: postgresql
when: debian_repos is defined and os_version_id in debian_repos
notify: "update apt cache"
- name: Получить и добавить Elasticsearch GPG ключ
ansible.builtin.shell: |
curl -fsSL {{ elasticsearch_gpg_url }} | gpg --dearmor -o /usr/share/keyrings/elasticsearch.gpg
args:
creates: /usr/share/keyrings/elasticsearch.gpg
notify: "update apt cache"
- name: Добавить репозиторий Elasticsearch для {{ os_version_id }}
ansible.builtin.apt_repository:
repo: "{{ debian_repos[os_version_id]['elasticsearch_repo'] }}"
state: present
filename: elasticsearch
when: debian_repos is defined and os_version_id in debian_repos
notify: "update apt cache"
- name: Получить скрипт установки Patroni repository для Debian/Ubuntu
ansible.builtin.get_url:
url: "https://packagecloud.io/install/repositories/patroni/patroni/script.deb.sh"
dest: /tmp/patroni-repo-install.sh
mode: '0755'
- name: Запустить скрипт установки Patroni repository
ansible.builtin.command: bash /tmp/patroni-repo-install.sh
args:
creates: /etc/apt/sources.list.d/patroni_patroni.list
notify: "update apt cache"
- name: Очистить временный файл установки Patroni
ansible.builtin.file:
path: /tmp/patroni-repo-install.sh
state: absent
- name: Обновить кэш пакетов после добавления всех репозиториев
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 0
- name: Выполнить обновление пакетов
ansible.builtin.apt:
upgrade: dist
update_cache: yes
autoremove: yes
autoclean: yes