Browse Source

alerta uwsgi

master
parent
commit
bdd449651f
2 changed files with 58 additions and 4 deletions
  1. +44
    -4
      tasks/main.yaml
  2. +14
    -0
      vars/main.yaml

+ 44
- 4
tasks/main.yaml View File

@@ -1,5 +1,11 @@
--- ---


- name: debian package requirements
apt:
pkg:
- uwsgi
- uwsgi-plugin-python3

- import_role: - import_role:
name: mongodb name: mongodb


@@ -13,9 +19,14 @@
name: alerta name: alerta
executable: pip3 executable: pip3


- name: alerta installation directory
file:
path: /opt/alerta
state: directory

- name: alerta-webui installation directory - name: alerta-webui installation directory
file: file:
path: /opt/alerta-webui
path: /opt/alerta/webui
state: directory state: directory


- name: get alerta-webui releases - name: get alerta-webui releases
@@ -27,13 +38,42 @@
- name: download latest alerta-webui release - name: download latest alerta-webui release
get_url: get_url:
url: "{{_alerta_webui_dl_url}}" url: "{{_alerta_webui_dl_url}}"
dest: /opt/alerta-webui/alerta-webui-{{_alerta_webui_version}}.tar.gz
dest: /opt/alerta/webui/alerta-webui-{{_alerta_webui_version}}.tar.gz


- name: extract alerta-webui release - name: extract alerta-webui release
unarchive: unarchive:
src: /opt/alerta-webui/alerta-webui-{{_alerta_webui_version}}.tar.gz
dest: /opt/alerta-webui
src: /opt/alerta/webui/alerta-webui-{{_alerta_webui_version}}.tar.gz
dest: /opt/alerta/webui
mode: u=rwx,g=rx,o=rx mode: u=rwx,g=rx,o=rx
owner: root owner: root
group: root group: root
remote_src: true remote_src: true

- name: alerta-webui config
copy:
content: "{{alerta_webui_config}}"
dest: /opt/alerta/config.json

- name: alerta user
user:
name: alerta
system: yes
home: /
register: _alerta_user

- name: alerta uwsgi configuration
copy:
content:
uwsgi: "{{alerta_uwsgi_config}}"
dest: /etc/uwsgi/apps-available/alerta.json

- name: enable alerta uwsgi configuration
file:
src: ../apps-available/alerta.json
dest: /etc/uwsgi/apps-enabled/alerta.json
state: link

- name: alerta wsgi python file
copy:
content: from alerta import app
dest: /opt/alerta/wsgi.py

+ 14
- 0
vars/main.yaml View File

@@ -1,3 +1,17 @@
--- ---
_alerta_webui_dl_url: "{{ _alerta_webui_releases.json.assets | json_query(\"[?name=='alerta-webui.tar.gz'].browser_download_url|[0]\") }}" _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 }}" _alerta_webui_version: "{{ _alerta_webui_releases.json.tag_name }}"

alerta_uwsgi_config:
uid: alerta
gid: alerta
chdir: /opt/alerta
mount: /api=wsgi.py
callable: app
manage-script-name: true
env: BASE_URL=/api
buffer-size: 32768
plugin: python3

alerta_webui_config:
endpoint: /api

Loading…
Cancel
Save