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

Added support to redhat centos OS #16

Open
wants to merge 4 commits into
base: master
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
45 changes: 1 addition & 44 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,7 @@
# tasks file
#

- name: include OS family/distribution specific variables
include_vars: "{{ item }}"
with_first_found:
- "../defaults/{{ ansible_os_family | lower }}-{{ ansible_distribution | lower }}_{{ ansible_distribution_version | lower }}.yml"
- "../defaults/{{ ansible_os_family | lower }}-{{ ansible_distribution | lower }}.yml"
- "../defaults/{{ ansible_os_family | lower }}.yml"

- include: debug.yml
when: debug | default(false)
tags: debug

- include: validation.yml
tags: validation

- name: ensure apt dependencies are installed
apt:
name="{{ item }}"
state=present
become: yes
when: ansible_distribution | lower == 'debian' and grafana_apt_dependencies is defined
with_items: "{{ grafana_apt_dependencies }}"

- name: ensure grafana apt key is present
apt_key:
url=https://packagecloud.io/gpg.key
id=D59097AB
state=present
become: yes
tags: [ apt ]

- name: ensure grafana apt repository is present
apt_repository:
repo="deb https://packagecloud.io/grafana/stable/{{ ansible_os_family | lower }}/ {{ grafana_apt_distribution }} main"
update_cache=yes
state=present
become: yes
tags: [ apt ]

- name: ensure grafana is installed
apt:
name=grafana
state=present
become: yes
tags: installation
- include_tasks: "setup-{{ansible_os_family}}.yml"

- name: Ensure integrity of grafana configuration.
template:
Expand Down
45 changes: 45 additions & 0 deletions tasks/setup-Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
- name: include OS family/distribution specific variables
include_vars: "{{ item }}"
with_first_found:
- "../defaults/{{ ansible_os_family | lower }}-{{ ansible_distribution | lower }}_{{ ansible_distribution_version | lower }}.yml"
- "../defaults/{{ ansible_os_family | lower }}-{{ ansible_distribution | lower }}.yml"
- "../defaults/{{ ansible_os_family | lower }}.yml"

- include: debug.yml
when: debug | default(false)
tags: debug

- include: validation.yml
tags: validation

- name: ensure apt dependencies are installed
apt:
name="{{ item }}"
state=present
become: yes
when: ansible_distribution | lower == 'debian' and grafana_apt_dependencies is defined
with_items: "{{ grafana_apt_dependencies }}"

- name: ensure grafana apt key is present
apt_key:
url=https://packages.grafana.com/gpg.key
id=D59097AB
state=present
become: yes
tags: [ apt ]

- name: ensure grafana apt repository is present
apt_repository:
repo="deb https://packagecloud.io/grafana/stable/{{ ansible_os_family | lower }}/ {{ grafana_apt_distribution }} main"
update_cache=yes
state=present
become: yes
tags: [ apt ]

- name: ensure grafana is installed
apt:
name=grafana
state=present
become: yes
tags: installation
24 changes: 24 additions & 0 deletions tasks/setup-RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
- name: Install wget package
yum: pkg=wget state=present

- name: Checking /opt directory exists
become: yes
file:
path: /opt
state: directory

- name: Downloading Grafana rpm file
get_url:
url: https://dl.grafana.com/oss/release/grafana-6.5.0-1.x86_64.rpm
dest: /opt

- name: Installing grafana...
yum:
name: /opt/grafana-6.5.0-1.x86_64.rpm
state: present

- name: Removing RPM file...
file:
state: absent
path: /opt/grafana-6.5.0-1.x86_64.rpm