-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Ishan Jain <[email protected]>
- Loading branch information
1 parent
f9e9693
commit 3614c5f
Showing
28 changed files
with
443 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
name: Alloy Molecule | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
defaults: | ||
run: | ||
working-directory: roles/alloy | ||
|
||
jobs: | ||
molecule: | ||
name: Molecule | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
distro: | ||
- rockylinux9 | ||
- ubuntu2204 | ||
- debian12 | ||
|
||
steps: | ||
- name: Check out the codebase. | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3. | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install test dependencies. | ||
run: pip3 install ansible molecule molecule-plugins[docker] docker | ||
|
||
- name: Run Molecule tests. | ||
run: molecule test | ||
env: | ||
PY_COLORS: '1' | ||
ANSIBLE_FORCE_COLOR: '1' | ||
MOLECULE_DISTRO: ${{ matrix.distro }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
- name: Install alloy | ||
--- | ||
- name: Deploy alloy | ||
hosts: all | ||
become: true | ||
|
||
roles: | ||
- role: grafana.grafana.alloy | ||
tasks: | ||
- name: Install alloy | ||
- name: Deploy alloy | ||
ansible.builtin.include_role: | ||
name: grafana.grafana.alloy | ||
vars: | ||
config: | | ||
alloy_config: | | ||
prometheus.scrape "default" { | ||
targets = [{"__address__" = "localhost:12345"}] | ||
forward_to = [prometheus.remote_write.prom.receiver] | ||
targets = [{"__address__" = "127.0.0.1:12345"}] | ||
forward_to = [prometheus.remote_write.prom.receiver] | ||
} | ||
prometheus.remote_write "prom" { | ||
endpoint { | ||
url = "https://prometheus-prod-13-prod-us-east-0.grafana.net/api/prom/push" | ||
basic_auth { | ||
username = "1493467" | ||
password = "glc_eyJvIjoiNjUyOTkyIiwibiI6InN0YWNrLTg5MDA0My1obS13cml0ZS1hc2FzIiwiayI6IjIwME9NeThmWlFpMGlmQzBGMTlJNDdqSiIsIm0iOnsiciI6InByb2QtdXMtZWFzdC0wIn19" | ||
} | ||
url = "http://mimir:9009/api/v1/push" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,32 @@ | ||
alloy_version: "1.3.1" | ||
--- | ||
# defaults file for alloy | ||
alloy_version: "latest" | ||
alloy_uninstall: false | ||
alloy_expose_port: false | ||
alloy_download_url_rpm: "https://github.com/grafana/alloy/releases/download/v{{ alloy_version }}/alloy-{{ alloy_version }}-1.{{ __alloy_arch }}.rpm" | ||
alloy_download_url_deb: "https://github.com/grafana/alloy/releases/download/v{{ alloy_version }}/alloy-{{ alloy_version }}-1.{{ __alloy_arch }}.deb" | ||
|
||
|
||
alloy_arch_mapping: | ||
x86_64: amd64 | ||
aarch64: arm64 | ||
armv7l: armhf | ||
i386: i386 | ||
ppc64le: ppc64le | ||
|
||
alloy_arch: "{{ alloy_arch_mapping[ansible_architecture] | default('amd64') }}" | ||
|
||
alloy_binary_url: "https://github.com/grafana/alloy/releases/download/v{{ alloy_version }}/alloy-linux-{{ alloy_arch }}.zip" | ||
|
||
alloy_service_name: "alloy" | ||
|
||
alloy_working_dir: "/opt/alloy" | ||
|
||
alloy_installation_dir: "{{ alloy_working_dir }}/bin" | ||
|
||
alloy_environment_file: "service.env" | ||
|
||
alloy_config_dir: "/etc/alloy" | ||
|
||
alloy_config_file: "config.alloy" | ||
|
||
alloy_service_user: "alloy" | ||
|
||
alloy_service_group: "alloy" | ||
alloy_user_groups: [] | ||
# alloy_user_groups: | ||
# - "systemd-journal" | ||
|
||
alloy_env_file_vars: {} | ||
|
||
alloy_flags_extra: {} | ||
|
||
alloy_start_after_service: '' | ||
|
||
alloy_config: | | ||
prometheus.scrape "default" { | ||
targets = [{"__address__" = "localhost:12345"}] | ||
forward_to = [prometheus.remote_write.prom.receiver] | ||
} | ||
prometheus.remote_write "prom" { | ||
endpoint { | ||
url = "http://mimir:9009/api/v1/push" | ||
} | ||
} | ||
# Configurable user groups that the Grafana Alloy can be put in so that it can access logs. | ||
alloy_user_groups: [] | ||
# alloy_env_file_vars: | ||
# CUSTOM_ARGS: "--server.http.listen-addr=0.0.0.0:12345 --stability.level=public-preview --feature.community-components.enabled=true" | ||
|
||
alloy_systemd_override: {} | ||
# alloy_systemd_override: | | ||
# [Service] | ||
# User=root | ||
|
||
alloy_config: {} | ||
# alloy_config: | | ||
# prometheus.scrape "default" { | ||
# targets = [{"__address__" = "127.0.0.1:12345"}] | ||
# forward_to = [prometheus.remote_write.prom.receiver] | ||
# } | ||
# prometheus.remote_write "prom" { | ||
# endpoint { | ||
# url = "http://mimir:9009/api/v1/push" | ||
# } | ||
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
--- | ||
# handlers file for alloy | ||
- name: Restart alloy | ||
listen: "restart alloy" | ||
ansible.builtin.systemd: | ||
name: "{{ alloy_service_name }}" | ||
daemon_reload: true | ||
name: alloy.service | ||
state: restarted | ||
become: true | ||
listen: "Restart alloy" | ||
|
||
- name: Check alloy is started properly | ||
ansible.builtin.include_tasks: ga-started.yml | ||
listen: "Restart alloy" | ||
enabled: true | ||
when: not ansible_check_mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
vars: | ||
alloy_version: "1.4.2" | ||
alloy_config: | | ||
prometheus.scrape "default" { | ||
targets = [{"__address__" = "127.0.0.1:12345"}] | ||
forward_to = [prometheus.remote_write.prom.receiver] | ||
} | ||
prometheus.remote_write "prom" { | ||
endpoint { | ||
url = "http://mimir:9009/api/v1/push" | ||
} | ||
} | ||
roles: | ||
- role: grafana.grafana.alloy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
options: | ||
ignore-errors: true | ||
driver: | ||
name: docker | ||
platforms: | ||
- name: instance | ||
image: "geerlingguy/docker-${MOLECULE_DISTRO:-rockylinux8}-ansible:latest" | ||
command: ${MOLECULE_DOCKER_COMMAND:-""} | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
cgroupns_mode: host | ||
privileged: true | ||
pre_build_image: true | ||
provisioner: | ||
name: ansible | ||
playbooks: | ||
converge: converge.yml |
Oops, something went wrong.