Files
homelab-infra/ansible/roles/vector/tasks/main.yml
T
karpenok 8ab5b65073
ansible-deploy / plan (push) Successful in 2s
ansible-lint / lint (push) Successful in 2s
ansible-deploy / deploy (core-mon, ) (push) Failing after 33s
ansible-deploy / deploy (core-net, ) (push) Failing after 28s
ansible-deploy / deploy (core-secrets, ) (push) Failing after 38s
ansible-deploy / deploy (ger-nod-02, ) (push) Failing after 31s
ansible-deploy / deploy (rus-central, ) (push) Failing after 49s
feat(vector): switch to native package with journald, docker_logs, and secret masking
2026-11-18 11:45:05 +07:00

61 lines
1.9 KiB
YAML

---
- name: Проверить наличие старого Docker-контейнера Vector
ansible.builtin.stat:
path: "{{ vector_legacy_dir }}/compose.yaml"
register: vector_legacy_compose
- name: Остановить старый Docker-контейнер Vector
ansible.builtin.command: docker compose -f {{ vector_legacy_dir }}/compose.yaml down --remove-orphans
when: vector_legacy_compose.stat.exists
changed_when: true
- name: Удалить каталог старого Docker-контейнера Vector
ansible.builtin.file:
path: "{{ vector_legacy_dir }}"
state: absent
when: vector_legacy_compose.stat.exists
- name: Подключить APT-репозиторий Vector
ansible.builtin.shell: curl -1sLf 'https://setup.vector.dev' | bash
args:
creates: /etc/apt/sources.list.d/vector.list
- name: Установить нативный пакет Vector
ansible.builtin.apt:
name: vector
state: present
update_cache: true
- name: Выдать пользователю vector доступ к journald и docker
ansible.builtin.user:
name: vector
groups:
- systemd-journal
- docker
append: true
register: vector_user_groups
- name: Подготовить каталог данных Vector
ansible.builtin.file:
path: "{{ vector_data_dir }}"
state: directory
owner: vector
group: vector
mode: "0750"
- name: Установить конфигурацию Vector
ansible.builtin.template:
src: vector.yaml.j2
dest: "{{ vector_config_path }}"
owner: root
group: vector
mode: "0640"
validate: "vector validate --no-environment %s"
register: vector_config
- name: Запустить и включить systemd-сервис Vector
ansible.builtin.systemd:
name: vector
enabled: true
state: "{{ 'restarted' if (vector_config is changed or vector_user_groups is changed) else 'started' }}"