grafana-ansible-collection
grafana-ansible-collection copied to clipboard
management of the config.river with the conversion of the config.yaml
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
Hey @lbrule , Thanks for adding this.
Also could you share a snippet of how you would use this in a playbook?
/- 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'
@gardar any thoughts here?
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.
@gardar is this okay from your aspect?