Skip to content

Grafana Agent ansible role. Installs grafana agent & sets up process as supervisor program.

License

Notifications You must be signed in to change notification settings

GameAnalytics/ansible-grafana-agent

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Role: Grafana Cloud Agent

Ansible Lint

Installs Grafana Cloud Agent on RedHat/CentOS or Debian/Ubuntu servers to collect observability data and sends it to Grafana Cloud.

This role installs and configures the latest version of Grafana Cloud Agent from GitHub releases. It also creates a Supervisor process.

It optionally installs Promtail, which is an agent which ships the contents of local logs to Grafana Cloud (Loki).

Requirements

None. Other than an account on Grafana Cloud -> Create account.

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml). You can get the values for your enviroment from the Grafana Cloud Portal.

Required

prometheus_user: <username>

Each service in Grafana Cloud has a unique service id or user. Once in the Grafana Cloud Portal click on Prometheus to get the value you need to provide for prometheus_user.

grafana_api_key: <key>

You can generate a new API Key in the API Keys section of the Grafana Cloud Portal. The role has to be MetricsPublisher.

metric_label: <label>

target_host: <host>

target_port: <port>

Above variables define scraping targets and labels for your endpoints. Endpoint name is /metrics by default.

Defaults

agent_version: latest

You can change the default version of the agent by specifying the agent_version variable. If not defined, will fallback to the latest Grafana Agent install. Change it to eg. "v0.18.1".

agent_location: /usr/local/bin

Location where the Grafana Cloud Agent's binary will be installed. The default location (/usr/local/bin) is preferred in systems where SELinux is enabled.

config_location: /etc/grafana

Location where the Grafana Cloud Agent's config will be stored. The default location (/etc/grafana) is preferred in systems where SELinux is enabled.

By default, this role will ensure Grafana Cloud Agent is running and enabled at boot.

loki_user: <username>

Each service in Grafana Cloud has a unique service id or user. Once in the Grafana Cloud Portal click on Loki to get the value you need to provide for loki_user. If this value is present, this role will install the Promtail agent and create a Supervisor process for it. It will scrape messages from /var/log and journald. For reference, see Journal Scraping.

Dependencies

None.

License

GPL-3.0 License

Author Information

This role was created in 2021 by Nicolas Leiva.

In this fork we modified the role to be compatible for setting up the agent in containers.

About

Grafana Agent ansible role. Installs grafana agent & sets up process as supervisor program.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jinja 75.7%
  • Makefile 24.3%