-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.yml
54 lines (47 loc) · 1.48 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
- name: Download Agent file
ansible.builtin.get_url:
url: "https://github.com/grafana/agent/releases/latest/download/grafana-agent-linux-{{ grafana_agent_type[ansible_architecture] }}.zip"
dest: "/tmp/agent-linux.zip"
mode: "0644"
- name: Install unzip
ansible.builtin.package:
name: unzip
state: present
when: install_unzip|bool
- name: Unarchive Agent
ansible.builtin.unarchive:
src: "/tmp/agent-linux.zip"
dest: "{{ agent_location }}"
remote_src: true
mode: "0755"
- name: Create directory for Agent's config file
ansible.builtin.file:
state: directory
recurse: true
path: "{{ config_location }}"
mode: u=rwX,g=rX,o=rX
- name: Create Agent's config file
ansible.builtin.template:
src: "{{ grafana_agent_config_template }}"
dest: "{{ config_location }}/agent-config.yaml"
mode: u=rw,g=r,o=r
force: true
notify: Reload Grafana agent service
- name: Create Systemd service
block:
- name: Template the new service file for Grafana agent
ansible.builtin.template:
src: "{{ grafana_agent_systemd_template }}"
dest: "{{ systemd_service_folder }}/grafana-agent.service"
mode: "0644"
notify: Reload Grafana agent service
- name: Enable and start Grafana agent service
ansible.builtin.service:
name: grafana-agent
state: started
enabled: true
- name: Install Promtail
ansible.builtin.include_tasks: "promtail.yml"
when:
- loki_user is defined