This repository has been archived on 2020-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
alerta.autonomic.zone/ansible/pre-deploy.yml

99 lines
2.5 KiB
YAML

---
- hosts: all
gather_facts: false
tasks:
- name: Load variables
include_vars:
dir: "{{ dokku_lib_root }}/data/ansible/alerta/vars/"
extensions:
- yml
- name: "Configure the {{ domain }} domain"
dokku_domains:
app: alerta
domains:
- "{{ domain }}"
state: present
- name: Create mongo database
no_log: true
shell: "
dokku
mongo:create
alerta
--password {{ db_passwd }}
--root-password {{ root_db_passwd }}
"
args:
creates: /var/lib/dokku/services/mongo/alerta
- name: Link mongo database to application
dokku_service_link:
app: alerta
name: alerta
service: mongo
- name: Create application directories
become: true
file:
path: /var/lib/alerta
state: directory
owner: dokku
group: dokku
- name: Copy over the /web/ configurations
become: true
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ docker_user_uid }}"
group: "{{ docker_user_gid }}"
mode: 0664
with_items:
- src: config.json
dest: /var/lib/alerta/config.json
# Note(decentral1se): can't use "template" module here
# because there are {{ }} jinja markers in this file!
- name: Copy over email templates
become: true
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ docker_user_uid }}"
group: "{{ docker_user_gid }}"
mode: 0664
with_items:
- src: email.tmpl
dest: /var/lib/alerta/email.tmpl
- name: Copy over the /app/ configurations
become: true
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: 0664
with_items:
- src: alerta.conf
dest: /var/lib/alerta/alerta.conf
- src: alertad.conf
dest: /var/lib/alerta/alertad.conf
- name: Specify docker volume mounts
dokku_storage:
app: alerta
mounts:
- /var/lib/alerta/email.tmpl:/app/email.tmpl
- /var/lib/alerta/alerta.conf:/app/alerta.conf
- /var/lib/alerta/alertad.conf:/app/alertad.conf
- /var/lib/alerta/config.json:/web/config.json
- name: Configure the dokku app environment
dokku_config:
app: alerta
restart: false
config:
SMTP_PASSWORD: "{{ smtp_passwd }}"