DevOps Engineer

Grafana Playbook

Grafana example

Grafana example

The Ansible playbook below can be used to quickly install a Grafana server.

---
- hosts: GrafanaServers
  tasks:
  - name: Install some packages, in this case apt-transport-https
    apt:
      name: "{{ packages }}"
      update_cache: yes
    vars:
      packages:
      - apt-transport-https
  - name: Add an Apt signing key, will not download if present
    apt_key:
      url: https://packagecloud.io/gpg.key
      state: present
  - name: Add Grafana repository into sources list
    apt_repository:
      repo: deb https://packagecloud.io/grafana/stable/debian/ stretch main
      state: present
  - name: Update repositories cache and install Grafana package
    apt:
      name: grafana
      update_cache: yes

You are most probably also intrested in installing a datasource like for example an ElasticSearch server.
You can find a playbook to install one right here.
Also consider installing Kibana, and guess what, I made a playbook for this too, here is the link.

Exit mobile version