Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of installation to RHEL/CentOS with yum package manager #19

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
grafana_enabled: true # The role is enabled
grafana_apt_repository: deb https://packagecloud.io/grafana/stable/debian/ jessie main
grafana_apt_key: https://packagecloud.io/gpg.key
grafana_yum_reposotory: https://packagecloud.io/grafana/stable/el/7/$basearch
grafana_yum_key: https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana

grafana_version: 4.1.2-* # Set version (set to latest to install latest version)

Expand Down
4 changes: 4 additions & 0 deletions tasks/grafana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
when: ansible_os_family == 'Debian'
tags: [grafana, grafana-install]

- include: install.rhel.yml
when: ansible_os_family == 'RedHat'
tags: [grafana, grafana-install]

- include: configure.yml
tags: [grafana, grafana-configure]
33 changes: 33 additions & 0 deletions tasks/install.rhel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---

- name: Add repository
yum_repository:
name: 'grafana'
baseurl: '{{ grafana_yum_reposotory }}'
repo_gpgcheck: yes
gpgcheck: yes
enabled: yes
gpgkey: '{{ grafana_yum_key }}'
sslverify: yes
sslcacert: '/etc/pki/tls/certs/ca-bundle.crt'
description: 'Grafana repo'
state: present
tags: [grafana, grafana-install]

- set_fact: grafana_release='grafana-{{grafana_version}}'
tags: [grafana, grafana-install]

- name: Install grafana | Install Grafana Release
yum: name="{{ grafana_release }}"
when: grafana_version != "latest"
notify:
- grafana restart
tags: [grafana, grafana-install]

- name: Install grafana | Install Grafana Latest
yum: name="grafana"
when: grafana_version == "latest"
notify:
- grafana restart
tags: [grafana, grafana-install]