Compare commits
9 Commits
6fccc69e03
...
04179b04eb
| Author | SHA1 | Date | |
|---|---|---|---|
| 04179b04eb | |||
| 5cac062a21 | |||
| 45f51b67b1 | |||
| 09ffb32784 | |||
| 5eeec4ad30 | |||
| 04e5bc7b50 | |||
| 8f8c56c04e | |||
| fdb0700e42 | |||
| e46a17e6b5 |
@@ -2,6 +2,7 @@
|
|||||||
grafana_alloy_version: "1.17.1"
|
grafana_alloy_version: "1.17.1"
|
||||||
grafana_alloy_config_dir: "/etc/alloy"
|
grafana_alloy_config_dir: "/etc/alloy"
|
||||||
grafana_alloy_data_dir: "/var/lib/alloy"
|
grafana_alloy_data_dir: "/var/lib/alloy"
|
||||||
|
grafana_alloy_ui_port: 12345
|
||||||
grafana_alloy_loki_port: 3100
|
grafana_alloy_loki_port: 3100
|
||||||
grafana_alloy_loki_url: "http://localhost:{{ grafana_alloy_loki_port }}/loki/api/v1/push"
|
grafana_alloy_loki_url: "http://localhost:{{ grafana_alloy_loki_port }}/loki/api/v1/push"
|
||||||
grafana_alloy_log_paths:
|
grafana_alloy_log_paths:
|
||||||
|
|||||||
@@ -15,6 +15,15 @@ platforms:
|
|||||||
cgroupns_mode: host
|
cgroupns_mode: host
|
||||||
privileged: true
|
privileged: true
|
||||||
|
|
||||||
|
- name: ubuntu
|
||||||
|
image: geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2404}-ansible:latest
|
||||||
|
pre_build_image: true
|
||||||
|
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||||
|
volumes:
|
||||||
|
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||||
|
cgroupns_mode: host
|
||||||
|
privileged: true
|
||||||
|
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
# kics-scan ignore-block
|
# kics-scan ignore-block
|
||||||
- name: "Check if Alloy is ready"
|
- name: "Check if Alloy is ready"
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "http://localhost:12345/-/ready"
|
url: "http://localhost:{{ grafana_alloy_ui_port }}/-/ready"
|
||||||
return_content: true
|
return_content: true
|
||||||
status_code: 200
|
status_code: 200
|
||||||
method: GET
|
method: GET
|
||||||
|
|||||||
@@ -23,26 +23,50 @@
|
|||||||
block:
|
block:
|
||||||
- name: "Install | Check Alloy version"
|
- name: "Install | Check Alloy version"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "alloy --version"
|
cmd: "alloy --version"
|
||||||
register: grafana_alloy_ver
|
register: grafana_alloy_ver
|
||||||
|
|
||||||
- name: "Install | Assert version correctness"
|
- name: "Install | Assert version correctness"
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: "grafana_alloy_version in grafana_alloy_ver.stdout"
|
that:
|
||||||
|
- "grafana_alloy_ver.rc == 0"
|
||||||
|
- "grafana_alloy_version in grafana_alloy_ver.stdout"
|
||||||
success_msg: "alloy version {{ grafana_alloy_version }} is installed and working"
|
success_msg: "alloy version {{ grafana_alloy_version }} is installed and working"
|
||||||
fail_msg: "alloy version {{ grafana_alloy_version }} is not installed or not working correctly"
|
fail_msg: "alloy version {{ grafana_alloy_version }} is not installed or not working correctly"
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
|
- name: "Install | Update apt cache on Debian"
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: true
|
||||||
|
when: ansible_facts["os_family"] == "Debian"
|
||||||
|
|
||||||
- name: "Install | Ensure unzip is present"
|
- name: "Install | Ensure unzip is present"
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name: "unzip"
|
name: "unzip"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "Install | Fetch and unpack the distribution"
|
- name: "Install | Download the distribution archive"
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "https://github.com/grafana/alloy/releases/download/v{{ grafana_alloy_version }}/alloy-linux-amd64.zip"
|
||||||
|
dest: "/tmp/alloy-linux-amd64.zip"
|
||||||
|
group: "alloy"
|
||||||
|
owner: "alloy"
|
||||||
|
mode: "0644"
|
||||||
|
timeout: 30
|
||||||
|
force: true
|
||||||
|
register: grafana_alloy_download_status
|
||||||
|
until: grafana_alloy_download_status is success
|
||||||
|
retries: 3
|
||||||
|
delay: 5
|
||||||
|
|
||||||
|
- name: "Install | Unpack and delete the distribution"
|
||||||
ansible.builtin.unarchive:
|
ansible.builtin.unarchive:
|
||||||
src: "https://github.com/grafana/alloy/releases/download/v{{ grafana_alloy_version }}/alloy-linux-amd64.zip"
|
src: "/tmp/alloy-linux-amd64.zip"
|
||||||
dest: "/tmp"
|
dest: "/tmp"
|
||||||
|
group: "alloy"
|
||||||
|
owner: "alloy"
|
||||||
remote_src: true
|
remote_src: true
|
||||||
|
|
||||||
- name: "Install | Put the binary under the PATH"
|
- name: "Install | Put the binary under the PATH"
|
||||||
@@ -56,8 +80,11 @@
|
|||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: "Install | Clean up the downloads"
|
- name: "Install | Clean up the downloads"
|
||||||
|
loop:
|
||||||
|
- "/tmp/alloy-linux-amd64"
|
||||||
|
- "/tmp/alloy-linux-amd64.zip"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/tmp/alloy-linux-amd64"
|
path: "{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: "Install | Create a systemd service unit"
|
- name: "Install | Create a systemd service unit"
|
||||||
@@ -65,6 +92,6 @@
|
|||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: alloy.service.j2
|
src: alloy.service.j2
|
||||||
dest: /etc/systemd/system/alloy.service
|
dest: /etc/systemd/system/alloy.service
|
||||||
owner: "alloy"
|
owner: "root"
|
||||||
group: "alloy"
|
group: "root"
|
||||||
mode: "0660"
|
mode: "0600"
|
||||||
|
|||||||
Reference in New Issue
Block a user