From 80edffde428a639c77be142379717644c9c61252 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Thu, 9 Apr 2020 19:06:09 +0200 Subject: [PATCH] Try to wire up the mailer --- Dockerfile | 2 ++ ansible/templates/alerta.conf | 18 ++++++++++++ ansible/templates/alertad.conf | 38 +++++++++++++------------- ansible/vars/alerta_mailer_api_key.yml | 9 ++++++ ansible/vars/all.yml | 2 ++ 5 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 ansible/templates/alerta.conf create mode 100644 ansible/vars/alerta_mailer_api_key.yml diff --git a/Dockerfile b/Dockerfile index 45c34ca..3df4df2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,4 +2,6 @@ FROM alerta/alerta-web:7.4.5 EXPOSE 8080 +RUN /venv/bin/pip install git+https://github.com/alerta/alerta-contrib.git#subdirectory=integrations/mailer + COPY . ${WORKDIR} diff --git a/ansible/templates/alerta.conf b/ansible/templates/alerta.conf new file mode 100644 index 0000000..000a3f1 --- /dev/null +++ b/ansible/templates/alerta.conf @@ -0,0 +1,18 @@ +[DEFAULT] +sslverify = no +output = psql +endpoint = http://localhost:8080/api +timezone = Europe/London + +[alerta-mailer] +key = "{{ alerta_mailer_api_key }}" +mail_to = "{{ mail_to }}" +mail_from = "{{ mail_from }}" +amqp_url = redis://localhost:6379/ +dashboard_url = http://localhost:8000 +smtp_username = "{{ smtp_username }}" +smtp_password = "{{ smtp_passwd }}" +smtp_use_ssl = False +debug = True +skip_mta = False +email_type = text diff --git a/ansible/templates/alertad.conf b/ansible/templates/alertad.conf index 2e81ebe..3a18bf1 100644 --- a/ansible/templates/alertad.conf +++ b/ansible/templates/alertad.conf @@ -1,4 +1,4 @@ -SITE_LOGO_URL = 'https://www.coops.tech/images/coops/autonomic' +SITE_LOGO_URL = "https://www.coops.tech/images/coops/autonomic" DEBUG = True @@ -34,33 +34,33 @@ OAUTH2_CLIENT_ID = "{{ oauth_client_id }}" OAUTH2_CLIENT_SECRET = "{{ oauth_client_secret }}" SEVERITY_MAP = { - 'fatal': 0, - 'critical': 1, - 'major': 2, - 'minor': 3, - 'warning': 4, - 'indeterminate': 5, - 'cleared': 5, - 'normal': 5, - 'ok': 5, - 'informational': 6, - 'debug': 7, - 'trace': 8, - 'unknown': 9 + "fatal": 0, + "critical": 1, + "major": 2, + "minor": 3, + "warning": 4, + "indeterminate": 5, + "cleared": 5, + "normal": 5, + "ok": 5, + "informational": 6, + "debug": 7, + "trace": 8, + "unknown": 9 } -DEFAULT_NORMAL_SEVERITY = 'normal' # 'normal', 'ok', 'cleared' -DEFAULT_PREVIOUS_SEVERITY = 'indeterminate' +DEFAULT_NORMAL_SEVERITY = "normal" +DEFAULT_PREVIOUS_SEVERITY = "indeterminate" -PLUGINS = ['reject', 'blackout', 'normalise'] +PLUGINS = ["reject", "blackout", "normalise"] DATABASE_URL = "postgres://{{ db_user }}:{{ db_passwd }}@{{ db_loc }}/{{ db_name }}" DATABASE_NAME = "{{ db_name }}" EMAIL_VERIFICATION = False -MAIL_FROM = "alerta-noreply@autonomic.zone" +MAIL_FROM = "{{ mail_from }}" SMTP_HOST = "mail.gandi.net" SMTP_PASSWORD = "{{ smtp_passwd }}" SMTP_PORT = "587" SMTP_STARTTLS = True -SMTP_USERNAME = 'alerta-noreply' +SMTP_USERNAME = "alerta-noreply" diff --git a/ansible/vars/alerta_mailer_api_key.yml b/ansible/vars/alerta_mailer_api_key.yml new file mode 100644 index 0000000..beca8f8 --- /dev/null +++ b/ansible/vars/alerta_mailer_api_key.yml @@ -0,0 +1,9 @@ +--- +alerta_mailer_api_key: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 66336232393337663930393532343664303330643162663065396662336534633232663534633666 + 6537373864323561666435326362303162613163643466350a303762386339323861353837376466 + 37353637346330353539623862366339613939303135333437336663393335363862303737376635 + 6530333732333131390a373765646333363137663363633235303764323030396534636630633832 + 37623530643038353731633065653138653665623933396639623334323535346437623737626464 + 6435336563366634343264373531323561333135343362386331 diff --git a/ansible/vars/all.yml b/ansible/vars/all.yml index 4b1cd61..abf3dee 100644 --- a/ansible/vars/all.yml +++ b/ansible/vars/all.yml @@ -7,3 +7,5 @@ http_port: "8080" keycloak_realm: "autonomic" keycloak_role: "worker-owner" keycloak_url: "https://id.autonomic.zone" +mail_from: "alerta-noreply@autonomic.zon" +mail_to: "kaboom@autonomic.zone"