Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

management of the config.river with the conversion of the config.yaml #149

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions examples/agent-mode-flow-with-dynamic-conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- hosts: all

Check warning on line 1 in examples/agent-mode-flow-with-dynamic-conf.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

1:1 [document-start] missing document start "---"
tasks:
- name: Install Grafana Agent
ansible.builtin.include_role:
name: grafana.grafana.grafana_agent
vars:
grafana_agent_mode: flow
# Change config file on the host to .river
grafana_agent_config_filename: config.river
# Remove default flags
grafana_agent_flags_extra:
server.http.listen-addr: '0.0.0.0:12345'

Check failure on line 12 in examples/agent-mode-flow-with-dynamic-conf.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

12:51 [new-line-at-end-of-file] no new line character at the end of file
5 changes: 5 additions & 0 deletions roles/grafana_agent/tasks/configure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
notify: "restart grafana-agent"
when: grafana_agent_provisioned_config_file | length == 0

- name: Create Grafana Agent River Config if flow mode for Grafana Agent

Check failure on line 43 in roles/grafana_agent/tasks/configure.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

command-instead-of-shell

Use shell only when shell functionality is required.
ansible.builtin.shell: "AGENT_MODE=flow {{ grafana_agent_install_dir }}/grafana-agent convert -f static {{ grafana_agent_config_dir }}/{{ grafana_agent_config_filename }} -o {{ grafana_agent_config_dir }}/{{ grafana_agent_config_filename }}"

Check warning on line 44 in roles/grafana_agent/tasks/configure.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

44:151 [line-length] line too long (243 > 150 characters)
notify: "restart grafana-agent"
when: grafana_agent_provisioned_config_file | length == 0

- name: Copy Grafana Agent config
ansible.builtin.copy:
src: "{{ grafana_agent_provisioned_config_file }}"
Expand Down
2 changes: 2 additions & 0 deletions roles/grafana_agent/templates/config.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ metrics:
logs:
{{ grafana_agent_logs_config | to_nice_yaml(indent=2,sort_keys=False) | indent(2) }}

{% if grafana_agent_mode == 'static' %}
#################################################################################################
# Configures traces collection #
#################################################################################################
# Docs: https://grafana.com/docs/agent/latest/configuration/traces-config/
traces:
{{ grafana_agent_traces_config | to_nice_yaml(indent=2,sort_keys=False) | indent(2) }}
{% endif %}

#################################################################################################
# Configures integrations for the agent #
Expand Down
Loading