Skip to content

Instantly share code, notes, and snippets.

@adiosamig
Created May 21, 2022 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adiosamig/843c40d5e000a4e5d941ceea56e8906b to your computer and use it in GitHub Desktop.
Save adiosamig/843c40d5e000a4e5d941ceea56e8906b to your computer and use it in GitHub Desktop.
---
- name: Install and set up grafana on Ubuntu 20.04
hosts: localhost
become: yes
gather_facts: False
tasks:
- name: Update apt repo and cache on all Ubuntu box
apt:
update_cache: yes
force_apt_get: yes
cache_valid_time: 3600
- name: Upgrade all packages on servers
apt:
upgrade: dist
force_apt_get: yes
- name: Install required packages
apt:
name:
- gnupg2
- curl
- software-properties-common
- name: Add the Grafana GPG key
shell: |
curl https://packages.grafana.com/gpg.key | sudo apt-key add -
add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
args:
warn: no
- name: Install the grafana package
apt:
name: grafana
state: present
update_cache: yes
notify:
- Start grafana
- Enable grafana
handlers:
- name: Start grafana
systemd:
name: grafana-server
state: started
- name: Enable grafana
systemd:
name: grafana-server
enabled: yes
- name: Start and Enable Nginx
systemd:
name: nginx
state: started
enabled: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment