Files
ansible-repo/playbooks/software/angie.yml
hogweed1 b483bdb421
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 0s
well,
2026-11-06 16:21:50 +10:00

87 lines
4.2 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.

---
##### TODO make it reverse-proxy for everything
- name: Install Angie web server using modern DEB822 standard
hosts: angie
become: true
tasks:
# 1. Зачищаем старые следы, если они случайно остались от прошлых попыток
- name: Purge legacy Angie files if they exist
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- /etc/apt/trusted.gpg.d/angie-signing.gpg
- /etc/apt/sources.list.d/angie.list
# Шаг 1: Скачиваем GPG-ключ локально (чтобы apt не зависел от внешнего сайта angie.software)
- name: Скачать GPG-ключ для Angie
ansible.builtin.get_url:
url: https://angie.software/keys/angie-signing.gpg
dest: /usr/share/keyrings/angie-signing.gpg
owner: root
group: root
mode: '0644'
# 2. Настраиваем репозиторий по канонам безопасности (DEB822 + Keyrings)
- name: Add Angie repository
ansible.builtin.deb822_repository:
name: angie
types: deb
### Формируем правильный URI на основе фактов о системе
### ansible_distribution_version вернет версию (например, '12')
##uris: "https://download.angie.software/angie/debian/{{ ansible_distribution_major_version }}"
# Меняем домен на твой Nexus. Обрати внимание: мажорную версию дистрибутива (12, 13)
# мы переносим в конец URI, так как в Nexus проксируется корень репозитория angie
uris: "https://nexus.guaranteedstruggle.host/repository/generic-angie-proxy/{{ ansible_distribution_major_version }}"
# ansible_distribution_release подставит кодовое имя (например, 'bookworm')
suites: "{{ ansible_distribution_release }}"
components: main
### Автоматически скачиваем ключ, дебронируем и изолируем его
##signed_by: https://angie.software/keys/angie-signing.gpg
# Указываем путь к скачанному локальному ключу
signed_by: /usr/share/keyrings/angie-signing.gpg
register: angie_repo_added
# 3. Обновляем кэш пакетов (только если репозиторий изменился или добавился)
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
when: angie_repo_added.changed
# 4. Устанавливаем сам веб-сервер и консоль управления
- name: Install Angie and console tools
ansible.builtin.apt:
name:
- angie
- angie-console-light
state: present
- name: Проверяем наличие персонального конфига на мастер-ноде
ansible.builtin.stat:
# Папка files лежит в корне, откуда вы запускаете playbook,
# поэтому здесь пишем прямой путь от корня запуска.
path: "/usr/share/ansible-repo/files/angie/{{ inventory_hostname }}.conf"
delegate_to: localhost
register: remote_config_file
- name: Копировать конфиг Angie только если есть персональный файл
ansible.builtin.copy:
src: "/usr/share/ansible-repo/files/angie/{{ inventory_hostname }}.conf"
dest: /etc/angie/http.d/default.conf
owner: rsync
group: rsync
mode: '0644'
# Проверяем, существует ли файл на мастер-ноде. Если нет — таска просто скипнется
# when: query('ansible.builtin.fileglob', '../../files/angie.' ~ inventory_hostname ~ '.conf') | length > 0
when: remote_config_file.stat.exists
notify: Restart Angie
handlers:
- name: Restart Angie
ansible.builtin.service:
name: angie
state: restarted