Created
May 21, 2022 19:59
-
-
Save adiosamig/843c40d5e000a4e5d941ceea56e8906b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- 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