Hello,
I am looking into upgrading Grafana from 6.6.2 to the latest, so I can then use newer dashboards that require newer Grafana versions. We use Ansible playbooks to deploy everything whenever we make a change (by issuing ansible-playbook prometheus.yml --become
). But, as you will notice in that code snippet, most changes are to the prometheus.yml playbook. I have never run the grafana.yml playbook yet. When I started my position, this was all already set up, so I basically just looked through all the configuration files trying to understand how it all worked. When I log into our existing Grafana and go to Configuration, I do see at the bottom “New Version Available!” with a download icon. Can I click this and will it auto-update?? EDIT: I realized I have a test Grafana server and clicked the New Version Available! button. It just takes you to the Download Page on grafana.com. I was able to update it by simply running two commands:
wget https://dl.grafana.com/oss/release/grafana-8.0.5-1.x86_64.rpm
sudo yum install grafana-8.0.5-1.x86_64.rpm
… so now I guess I’m just wondering how/where to change anything in any of my Ansible playbooks or config files… to update my production Grafana instance.
I realize I might be posting this in the wrong forum entirely, and maybe should be in the Ansible forums, but it’s worth a shot posting here. The reason I’m trying to find out how to do it via Ansible is because I have a feeling if I manually update it via the GUI, the next time I run prometheus.yml, it might revert back to the old version because of something I don’t quite understand. I have “imported” some dashboards via the GUI, and I also have a feeling if/when I run grafana.yml, those manually imported dashboards will disappear, because I don’t see them listed in the grafana.yml file.
I can’t find anything regarding “version” in my grafana.yml file, but at the bottom I see:
roles:
- cloudalchemy.grafana
Ansible.com boasts “Simple, agentless IT automation that anyone can use”. I sort of disagree with that as I’m still trying to understand it all. Maybe if you grew up in code-land, it would be easy. I grew up in GUI land.
Hi @dborchert
I agree. Ansible gets super complex very quickly.
I think you should ask the Ansible folks about this, but I’m pretty sure that the cloudalchemy.grafana
role is designed to help one deploy Grafana resources via Ansible. I don’t know what distro you are running Grafana on, or how that instance is managed, so I am very wary to give any advice. The only advice I can give is don’t test anything on your production instance.
I think an Ansible role that installs Grafana on Debian/Ubuntu would look something like this:
---
# tasks file for deploy grafana
- name: Install nessesary package
apt:
name: apt-transport-https
state: present
update_cache: yes
- name: add grafana gpg key
shell: curl https://packages.grafana.com/gpg.key | sudo apt-key add -
- name: add grafana repo
apt_repository:
repo: deb https://packages.grafana.com/oss/deb stable main
state: present
filename: grafana
- name: Install grafana
apt:
name: grafana
state: present
update_cache: yes
- name: Enable and start grafana service
service:
name: grafana-server
enabled: yes
state: started
I haven’t tested this. And again, this role would pull whatever version is the current stable version, and auto-updating versions like that might not be advisable for your company.
I would move slowly and carefully. Grafana 6 is old enough that if you updated to Grafana 8, some things are bound to break. I would make sure you have a solid database backup policy in place before testing an update.
I hope this helps a bit!
1 Like
Thanks @mattabrams – it’s AWS’ Linux 2 version which is Redhad/CentOS (I used the Red Hat, CentOS, RHEL, and Fedora commands from this page, to install/upgrade Grafana on my test box).
Also, I just found some documentation from the person who originally set up all the monitoring:
Updating cloudalchemy ansible-galaxy roles:
Note: It may be necessary to update our playbooks to keep in sync with updated roles. An example of this would be updating the <SERVICE_VERSION> property (e.g. prometheus_version) in the playbook to keep up with current Prometheus releases
sudo ansible-galaxy install cloudalchemy.node-exporter --force
sudo ansible-galaxy install cloudalchemy.alertmanager --force
sudo ansible-galaxy install cloudalchemy.pushgateway --force
sudo ansible-galaxy install cloudalchemy.prometheus --force
sudo ansible-galaxy install cloudalchemy.blackbox-exporter --force
sudo ansible-galaxy install cloudalchemy.grafana --force
Rather than setting up a vanilla linux box and only installing Grafana, I might do what I originally did months ago and clone the entire EC2 instance, then run that sudo ansible-galaxy install cloudalchemy.grafana --force
command on the cloned instance. That, or just contact the original installer
Here’s what I see in the cloudalchemy.grafana playbook:
Thanks for your input either way…
My bad, looks like cloudalchemy.grafana
does have an install task.
And based on your image, if your script is already set up to pull the latest
version of Grafana, then that should update you from your current version 6.x.