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

Conversation

lbrule
Copy link

@lbrule lbrule commented Feb 12, 2024

This fork will permit to realize a config.river of the flow mode thanks to the config.yaml of the static mode.

The objective is to deploy a grafana agent in mode flow with a dynamic configuration and not only with a config.river already configured before the deployement by ansible.

The solution that i have used it to convert the static format to the flow format is the following command:

  • name: Create Grafana Agent River Config if flow mode for Grafana Agent
    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 }}"
    notify: "restart grafana-agent"
    when: grafana_agent_provisioned_config_file | length == 0

I have made any tests and it is ok for me

Regards
Ludovic

@CLAassistant
Copy link

CLAassistant commented Feb 12, 2024

CLA assistant check
All committers have signed the CLA.

@ishanjainn
Copy link
Member

Hey @lbrule , Thanks for adding this.

Also could you share a snippet of how you would use this in a playbook?

@lbrule
Copy link
Author

lbrule commented Feb 12, 2024

/- hosts: all
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'

Copy link
Member

@ishanjainn ishanjainn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, LGTM
Will get it merged in next release

@ishanjainn
Copy link
Member

@gardar any thoughts here?

Copy link
Collaborator

@gardar gardar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this work on the second run of the ansible role when it has already converted the config?

@AdminAosCompagny
Copy link

Hello @gardar

The config.river is re generated always whene we run again the role. So every time we generate the config.yaml for the static mode and we do a conversion in order to obtain the config.river for the flow mode.

@ishanjainn
Copy link
Member

@gardar is this okay from your aspect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants