Files
DevOpsLab/roles/repo/tasks/astra.yml
Сергей Антропов 23e1a6037b Добавлена роль 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
2025-10-30 03:13:35 +03:00

120 lines
4.1 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.

---
# Задачи для Astra Linux
# Автор: Сергей Антропов
# Сайт: https://devops.org.ru
# Astra Linux основан на Debian, используем apt
- name: Установить необходимые пакеты для работы с репозиториями
ansible.builtin.apt:
name:
- ca-certificates
- curl
- gnupg
- lsb-release
state: present
update_cache: yes
- name: Создать директорию для GPG ключей
ansible.builtin.file:
path: /usr/share/keyrings
state: directory
mode: '0755'
- name: Получить и добавить Docker GPG ключ (используем ключ Debian)
ansible.builtin.shell: |
curl -fsSL https://download.docker.com/linux/debian/gpg | 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 для Astra Linux
ansible.builtin.apt_repository:
repo: "{{ astra_repos['docker_repo'] }}"
state: present
filename: docker-ce
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 для Astra Linux
ansible.builtin.apt_repository:
repo: "{{ astra_repos['postgresql_repo'] }}"
state: present
filename: postgresql
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 для Astra Linux
ansible.builtin.apt_repository:
repo: "{{ astra_repos['elasticsearch_repo'] }}"
state: present
filename: elasticsearch
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: Установить debian-archive-keyring для поддержки Debian репозиториев
ansible.builtin.apt:
name: "{{ astra_repos['debian_archive_keyring'] }}"
state: present
notify: "update apt cache"
- name: Добавить ключ репозитория Лаборатории 50
ansible.builtin.shell: |
wget -qO - {{ astra_repos['lab50_key_url'] }} | apt-key add -
args:
creates: /etc/apt/trusted.gpg.d/lab50.gpg
notify: "update apt cache"
- name: Добавить репозиторий Лаборатории 50
ansible.builtin.apt_repository:
repo: "{{ astra_repos['lab50_repo'] }}"
state: present
filename: lab50
notify: "update apt cache"
- name: Добавить репозиторий с исходниками Лаборатории 50
ansible.builtin.apt_repository:
repo: "{{ astra_repos['lab50_src_repo'] }}"
state: present
filename: lab50-src
notify: "update apt cache"
- name: Обновить кэш пакетов после добавления всех репозиториев
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 0
- name: Выполнить обновление пакетов
ansible.builtin.apt:
upgrade: dist
update_cache: yes
autoremove: yes
autoclean: yes