initial commit

This commit is contained in:
Ansible Servercow
2024-11-19 16:04:17 +01:00
commit 67c5aae913
26 changed files with 438 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
---
- name: Find mailcow-dockerized directory
vars:
mailcow_search_paths:
- /opt
- /data
- /root
ansible.builtin.find:
file_type: directory
paths: "{{ mailcow_search_paths }}"
patterns: mailcow-dockerized
recurse: yes
register: mailcow_dir_result
ignore_errors: true

View File

@@ -0,0 +1,12 @@
---
- name: Start mailcow stack
community.docker.docker_compose_v2:
project_src: "{{ docker_compose_path }}"
state: present
register: output
- name: Print Replay
debug:
var: output
when: verbose | bool

View File

@@ -0,0 +1,11 @@
---
- name: Stop mailcow stack
community.docker.docker_compose_v2:
project_src: "{{ docker_compose_path }}"
state: absent
register: output
- name: Print Replay
debug:
var: output
when: verbose | bool

View File

@@ -0,0 +1,22 @@
---
- name: Check if mailcow.conf exists
ansible.builtin.stat:
path: "{{ mailcow_dir_result.files[0].path }}/mailcow.conf"
register: mailcow_conf
when: mailcow_dir_result.files[0].path is defined
- name: Check mailcow Version
ansible.builtin.shell: |
cd {{ mailcow_dir_result.files[0].path }}/data/web/inc
grep -oP '\$MAILCOW_GIT_VERSION="\K[^"]+' app_info.inc.php
register: local_mailcow_version
when: mailcow_conf.stat.exists
- name: Check Disk Utilization
import_role:
name: roles/system
tasks_from: check-disk-utilization.yaml
- name: Update mailcow
shell: "cd {{ mailcow_dir_result.files[0].path }} && git fetch && git checkout origin/master update.sh && ./update.sh --force"
when: local_mailcow_version.stdout != github_mailcow_ver and mailcow_conf.stat.exists and disk_space_output | bool