56 lines
1.4 KiB
YAML
56 lines
1.4 KiB
YAML
|
|
---
|
||
|
|
- name: Install Grafana Alloy
|
||
|
|
block:
|
||
|
|
- name: Add Grafana GPG apt key
|
||
|
|
ansible.builtin.apt_key:
|
||
|
|
url: https://apt.grafana.com/gpg.key
|
||
|
|
state: present
|
||
|
|
|
||
|
|
- name: Add Grafana repository
|
||
|
|
ansible.builtin.apt_repository:
|
||
|
|
repo: "deb https://apt.grafana.com stable main"
|
||
|
|
state: present
|
||
|
|
update_cache: yes
|
||
|
|
|
||
|
|
- name: Install Alloy
|
||
|
|
ansible.builtin.apt:
|
||
|
|
name: alloy
|
||
|
|
state: present
|
||
|
|
update_cache: yes
|
||
|
|
|
||
|
|
- name: Create Alloy configuration directory
|
||
|
|
ansible.builtin.file:
|
||
|
|
path: /etc/alloy
|
||
|
|
state: directory
|
||
|
|
mode: '0755'
|
||
|
|
|
||
|
|
- name: Copy Alloy configuration
|
||
|
|
template:
|
||
|
|
src: "{{ playbook_dir }}/files/alloy.river"
|
||
|
|
dest: /etc/alloy/config.river
|
||
|
|
mode: '0644'
|
||
|
|
notify: restart alloy
|
||
|
|
|
||
|
|
- name: Add alloy user to systemd-journal and adm groups
|
||
|
|
ansible.builtin.user:
|
||
|
|
name: alloy
|
||
|
|
groups: systemd-journal,adm
|
||
|
|
append: yes
|
||
|
|
notify: restart alloy
|
||
|
|
|
||
|
|
- name: Copy Alloy systemd service file
|
||
|
|
ansible.builtin.copy:
|
||
|
|
src: "{{ playbook_dir }}/files/alloy.service"
|
||
|
|
dest: /etc/systemd/system/alloy.service
|
||
|
|
mode: '0644'
|
||
|
|
notify:
|
||
|
|
- reload systemd
|
||
|
|
- restart alloy
|
||
|
|
|
||
|
|
- name: Enable and start Alloy service
|
||
|
|
ansible.builtin.systemd:
|
||
|
|
name: alloy
|
||
|
|
enabled: yes
|
||
|
|
state: started
|
||
|
|
daemon_reload: yes
|