From 7c603a77cf291257908e1ccf0bce06793a117642 Mon Sep 17 00:00:00 2001 From: tejash-jl Date: Wed, 27 Nov 2019 13:06:41 +0530 Subject: [PATCH 1/4] Added redhat OS script file --- tasks/setup-RedHat.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tasks/setup-RedHat.yml diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml new file mode 100644 index 0000000..fe8a06a --- /dev/null +++ b/tasks/setup-RedHat.yml @@ -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 From 0851f81fefaedf6e7ebc47f6242fd9690e4ee95c Mon Sep 17 00:00:00 2001 From: tejash-jl Date: Wed, 27 Nov 2019 13:07:37 +0530 Subject: [PATCH 2/4] Created debian os script file --- tasks/setup-Debian.yml | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tasks/setup-Debian.yml diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml new file mode 100644 index 0000000..4862a04 --- /dev/null +++ b/tasks/setup-Debian.yml @@ -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://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 From ea1bfbdede296e5dc33422433461a21aac72d581 Mon Sep 17 00:00:00 2001 From: tejash-jl Date: Wed, 27 Nov 2019 13:09:26 +0530 Subject: [PATCH 3/4] Updated main tasks to include tasks based on OS --- tasks/main.yml | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index a5aa7e3..cdd5a3d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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: From c25ece9f9b440f76188623ab78828cedb09f64c7 Mon Sep 17 00:00:00 2001 From: tejash-jl Date: Thu, 28 Nov 2019 13:31:35 +0530 Subject: [PATCH 4/4] Updated grafana apt-key url --- tasks/setup-Debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 4862a04..a165706 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -23,7 +23,7 @@ - name: ensure grafana apt key is present apt_key: - url=https://packagecloud.io/gpg.key + url=https://packages.grafana.com/gpg.key id=D59097AB state=present become: yes