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.
This commit is contained in:
parent
3f944df048
commit
010d8f93c4
12 changed files with 353 additions and 1 deletions
12
roles/monica/tasks/Ubuntu.yml
Normal file
12
roles/monica/tasks/Ubuntu.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
## install requisites
|
||||
- name: Ensure openssl installed
|
||||
ansible.builtin.package:
|
||||
name: "openssl"
|
||||
state: present
|
||||
become: yes
|
||||
tags:
|
||||
- apt
|
||||
- download
|
||||
- packages
|
||||
|
||||
40
roles/monica/tasks/main.yml
Normal file
40
roles/monica/tasks/main.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
- 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"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue