create molecule scenario for monitoring role

This commit is contained in:
HgO
2020-12-02 17:22:59 +01:00
parent 0f32a76e38
commit 2ace573ac9
21 changed files with 226 additions and 79 deletions

View File

@@ -1,36 +1,39 @@
- name: add grafana GPG apt key
- name: Install GPG package
package:
name: gpg
state: present
- name: Add Grafana GPG apt key
apt_key:
url: https://packages.grafana.com/gpg.key
state: present
- block:
- name: add grafana repository
apt_repository:
repo: deb https://packages.grafana.com/oss/deb stable main
state: present
register: grafana_repo
notify: restart grafana
- name: Add Grafana repository
apt_repository:
repo: deb https://packages.grafana.com/oss/deb stable main
state: present
register: grafana_repo
notify: restart grafana
- name: update apt cache
apt:
update_cache: yes
cache_valid_time: 3600
when: grafana_repo is changed
- name: Update apt cache
apt:
update_cache: yes
cache_valid_time: 3600
when: grafana_repo is changed
- name: install grafana package
apt:
pkg: grafana
state: present
notify: restart grafana
- name: Install grafana package
package:
name: grafana
state: present
notify: restart grafana
- name: copy grafana config
- name: Copy Grafana config
template:
src: grafana.ini.j2
dest: /etc/grafana/grafana.ini
become: yes
notify: restart grafana
- name: enable grafana service
- name: Start and enable Grafana service
systemd:
name: grafana-server
state: started
@@ -53,12 +56,13 @@
includes:
- "{{ nginx_config_dir }}/{{ inventory_hostname }}.d/*.conf"
- name: ensure nginx config directory exists
- name: Ensure Nginx config directory exists
file:
path: "{{ nginx_config_dir }}/{{ inventory_hostname }}.d"
state: directory
- include_role:
- name: Configure Nginx for Grafana
include_role:
name: nginx
tasks_from: configure
vars:

View File

@@ -1,6 +1,5 @@
---
- import_tasks: grafana.yml
become: yes
tags: grafana
- import_tasks: alertmanager.yml
tags: alertmanager