cloudserve-infrastructure/roles/monica/tasks/main.yml
Marty Oehme 010d8f93c4
Add monica deployment
Added basic monica docker deployment.

A key which is required for monica is automatically generated on
deployment.
Optionally, geolocation and weather api can be enabled.
Mail-sending functionality is disabled by default but can be enabled
with any compatible smtp server set up.
2021-10-26 18:11:48 +02:00

40 lines
1.1 KiB
YAML

---
- name: "Select tasks for {{ ansible_distribution }} {{ ansible_distribution_major_version }}"
include_tasks: "{{ distribution }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
loop_control:
loop_var: distribution
- name: Generate key
ansible.builtin.shell: echo -n 'base64:'; openssl rand -base64 32
register: monica_app_key
- set_fact:
monica_app_key={{ monica_app_key.stdout }}
## install container
- name: Check upstream status
community.docker.docker_container_exec:
container: "{{ caddy_container_id }}"
command: >
curl localhost:2019/id/{{ stack_name }}_upstream/
register: result
changed_when: (result.stdout | from_json) != (lookup('template', 'upstream.json.j2') | from_yaml)
become: yes
notify: "update monica upstream"
- name: Deploy to swarm
community.general.docker_stack:
name: "{{ stack_name }}"
state: present
prune: yes
compose:
- "{{ stack_compose }}"
become: yes
tags:
- docker-swarm
notify: "update monica upstream"