Browse Source

alerta configuration

master
parent
commit
db0194330f
5 changed files with 33 additions and 0 deletions
  1. +2
    -0
      defaults/main.yaml
  2. +17
    -0
      tasks/local_facts.yaml
  3. +8
    -0
      tasks/main.yaml
  4. +3
    -0
      templates/alertad.conf.j2
  5. +3
    -0
      vars/main.yaml

+ 2
- 0
defaults/main.yaml View File

@@ -1,2 +1,4 @@
---
alerta_server_name: "{{ inventory_hostname }}"

alerta_secret_key: "{{ ansible_local.alerta.secret_key }}"

+ 17
- 0
tasks/local_facts.yaml View File

@@ -0,0 +1,17 @@
---

- name: ansible local facts directory
file:
path: /etc/ansible/facts.d
state: directory

- name: set ansible local fact
copy:
content: "{{_local_facts|to_json}}"
dest: /etc/ansible/facts.d/{{role_name}}.fact
mode: 0600
register: _local_facts_set

- name: Gathering Facts
setup:
when: _local_facts_set.changed

+ 8
- 0
tasks/main.yaml View File

@@ -1,4 +1,6 @@
---
- import_tasks: local_facts.yaml


- name: debian package requirements
apt:
@@ -82,6 +84,12 @@
dest: /opt/alerta/wsgi.py
notify: restart uwsgi

- name: alerta configuration
template:
src: alertad.conf.j2
dest: /etc/alertad.conf
notify: restart uwsgi

- include_role:
name: certificate
vars:


+ 3
- 0
templates/alertad.conf.j2 View File

@@ -0,0 +1,3 @@
{{ansible_managed|comment}}
SECRET_KEY = '{{alerta_secret_key}}'
BASE_URL = '/api'

+ 3
- 0
vars/main.yaml View File

@@ -1,4 +1,7 @@
---
_local_facts:
secret_key: "{% if not ansible_local[role_name].secret_key is defined %}{{ lookup('password', '/dev/null length=64 chars=ascii_letters,digits') }}{% else %}{{ ansible_local[role_name].secret_key }}{% endif %}"

_alerta_webui_dl_url: "{{ _alerta_webui_releases.json.assets | json_query(\"[?name=='alerta-webui.tar.gz'].browser_download_url|[0]\") }}"
_alerta_webui_version: "{{ _alerta_webui_releases.json.tag_name }}"



Loading…
Cancel
Save