feat(snappymail): update snappymail
This commit is contained in:
@@ -25,7 +25,7 @@ services:
|
||||
domain:
|
||||
public: "vpn"
|
||||
ports:
|
||||
upd: "11290"
|
||||
udp: "11290"
|
||||
crowdsec:
|
||||
domain:
|
||||
internal: "crowdsec"
|
||||
@@ -144,6 +144,15 @@ services:
|
||||
http: "3000" # app
|
||||
dependency:
|
||||
web: "app-public"
|
||||
snappymail:
|
||||
domain:
|
||||
public: "webmail"
|
||||
internal: "webmail.app"
|
||||
ports:
|
||||
http: "8888"
|
||||
subuid: "100081"
|
||||
dependency:
|
||||
web: "app-public"
|
||||
vaultwarden:
|
||||
domain:
|
||||
public: "vault"
|
||||
@@ -270,7 +279,7 @@ version:
|
||||
# common
|
||||
caddy: "2.11.4"
|
||||
# infra
|
||||
step: "0.30.2"
|
||||
ca: "0.30.2"
|
||||
## Postgresql
|
||||
postgresql: "18.4"
|
||||
### For immich - https://github.com/immich-app/base-images/blob/main/postgres/versions.yaml
|
||||
@@ -292,7 +301,7 @@ version:
|
||||
redis: "8.8.0"
|
||||
immich: "v2.7.5"
|
||||
paperless: "2.20.15"
|
||||
nextcloud: "34.0.0"
|
||||
nextcloud: "34.0.1"
|
||||
collabora: "26.04.1.4.1"
|
||||
sure: "0.7.1-hotfix.1"
|
||||
outline: "1.8.1"
|
||||
@@ -300,3 +309,4 @@ version:
|
||||
mealie: "v3.19.2"
|
||||
homebox: "0.26.2"
|
||||
homepage: "v1.13.2"
|
||||
snappymail: "v2.38.2"
|
||||
|
||||
@@ -178,6 +178,14 @@
|
||||
tags: ["site", "vaultwarden"]
|
||||
tags: ["site", "vaultwarden"]
|
||||
|
||||
- name: Set snappymail
|
||||
ansible.builtin.include_role:
|
||||
name: "app"
|
||||
tasks_from: "services/set_snappymail"
|
||||
apply:
|
||||
tags: ["site", "snappymail"]
|
||||
tags: ["site", "snappymail"]
|
||||
|
||||
- name: Set gitea
|
||||
ansible.builtin.include_role:
|
||||
name: "app"
|
||||
|
||||
@@ -146,3 +146,14 @@
|
||||
changed_when: false
|
||||
listen: "notification_restart_homepage"
|
||||
ignore_errors: true # noqa: ignore-errors
|
||||
|
||||
- name: Restart snappymail
|
||||
ansible.builtin.systemd:
|
||||
name: "snappymail.service"
|
||||
state: "restarted"
|
||||
enabled: true
|
||||
scope: "user"
|
||||
daemon_reload: true
|
||||
changed_when: false
|
||||
listen: "notification_restart_snappymail"
|
||||
ignore_errors: true # noqa: ignore-errors
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
- "data/containers/homebox/data"
|
||||
- "containers/homebox"
|
||||
- "containers/homebox/ssl"
|
||||
become: true
|
||||
|
||||
- name: Deploy root certificate
|
||||
ansible.builtin.copy:
|
||||
@@ -21,7 +20,6 @@
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ node['group'] }}"
|
||||
mode: "0440"
|
||||
become: true
|
||||
notify: "notification_restart_homebox"
|
||||
no_log: true
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
---
|
||||
- name: Create snappymail directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ node['home_path'] }}/{{ item }}"
|
||||
state: "directory"
|
||||
owner: "{{ services['snappymail']['subuid'] }}"
|
||||
group: "{{ node['group'] }}"
|
||||
mode: "0770"
|
||||
loop:
|
||||
- "data/containers/snappymail"
|
||||
- "data/containers/snappymail/data"
|
||||
- "containers/snappymail"
|
||||
- "containers/snappymail/ssl"
|
||||
- "containers/snappymail/configs"
|
||||
- "containers/snappymail/domains"
|
||||
become: true
|
||||
|
||||
- name: Deploy root certificate
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
{{ hostvars['console']['ca']['root']['crt'] }}
|
||||
dest: "{{ node['home_path'] }}/containers/snappymail/ssl/{{ root_cert_filename }}"
|
||||
owner: "{{ services['snappymail']['subuid'] }}"
|
||||
group: "{{ node['group'] }}"
|
||||
mode: "0440"
|
||||
become: true
|
||||
notify: "notification_restart_snappymail"
|
||||
no_log: true
|
||||
|
||||
- name: Pull image
|
||||
containers.podman.podman_image:
|
||||
name: "ghcr.io/the-djmaze/snappymail"
|
||||
tag: "{{ version['containers']['snappymail'] }}"
|
||||
state: "present"
|
||||
pull: true
|
||||
|
||||
- name: Deploy config files
|
||||
ansible.builtin.template:
|
||||
src: "{{ hostvars['console']['node']['config_path'] }}/services/containers/app/snappymail/{{ item.src }}.j2"
|
||||
dest: "{{ node['home_path'] }}/containers/snappymail/{{ item.dest }}"
|
||||
owner: "{{ services['snappymail']['subuid'] }}"
|
||||
group: "{{ node['group'] }}"
|
||||
mode: "0644"
|
||||
loop:
|
||||
- src: "configs/application.ini"
|
||||
dest: "configs/application.ini"
|
||||
- src: "domains/domain.ini"
|
||||
dest: "domains/{{ domain['internal'] }}.ini"
|
||||
loop_control:
|
||||
label: "{{ item.src | basename }}"
|
||||
become: true
|
||||
notify: "notification_restart_snappymail"
|
||||
|
||||
- name: Deploy snappymail.container file
|
||||
ansible.builtin.template:
|
||||
src: "{{ hostvars['console']['node']['config_path'] }}/services/containers/app/snappymail/snappymail.container.j2"
|
||||
dest: "{{ node['home_path'] }}/.config/containers/systemd/snappymail.container"
|
||||
owner: "{{ services['snappymail']['subuid'] }}"
|
||||
group: "{{ node['group'] }}"
|
||||
mode: "0644"
|
||||
become: true
|
||||
notify: "notification_restart_snappymail"
|
||||
|
||||
- name: Enable snappymail.service
|
||||
ansible.builtin.systemd:
|
||||
name: "snappymail.service"
|
||||
state: "started"
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
scope: "user"
|
||||
|
||||
- name: Check container archive images
|
||||
ansible.builtin.stat:
|
||||
path: "{{ node['home_path'] }}/archives/containers/ghcr.io_the-djmaze_snappymail_{{ version['containers']['snappymail'] }}.tar"
|
||||
register: container_archive_images
|
||||
|
||||
- name: Save container archive images
|
||||
containers.podman.podman_save:
|
||||
image:
|
||||
- "ghcr.io/the-djmaze/snappymail:{{ version['containers']['snappymail'] }}"
|
||||
dest: "{{ node['home_path'] }}/archives/containers/ghcr.io_the-djmaze_snappymail_{{ version['containers']['snappymail'] }}.tar"
|
||||
format: "oci-archive"
|
||||
force: false
|
||||
when: not container_archive_images.stat.exists
|
||||
|
||||
- name: Fetch container archive images
|
||||
ansible.builtin.fetch:
|
||||
src: "{{ node['home_path'] }}/archives/containers/ghcr.io_the-djmaze_snappymail_{{ version['containers']['snappymail'] }}.tar"
|
||||
dest: "{{ hostvars['console']['node']['data_path'] }}/images/containers/"
|
||||
flat: true
|
||||
@@ -120,7 +120,7 @@
|
||||
/usr/bin/kopia repository connect filesystem \
|
||||
--path="{{ node['home_path'] }}/data/kopia/repository" \
|
||||
--override-username="il" \
|
||||
--override-hostname="{{ node['name'] }}.{{ domain['internal'] }}" \
|
||||
--override-hostname="{{ node['name'] }}.{{ domain['internal'] }}"
|
||||
when:
|
||||
- not is_kopia_repository.stat.exists
|
||||
- is_repository_created.rc == 0
|
||||
@@ -267,7 +267,7 @@
|
||||
changed_when: true
|
||||
no_log: true
|
||||
|
||||
- name: Deploy kopia servcer service file
|
||||
- name: Deploy kopia server service file
|
||||
ansible.builtin.template:
|
||||
src: "{{ hostvars['console']['node']['config_path'] }}/services/systemd/common/kopia/kopia-server.service.j2"
|
||||
dest: "{{ node['home_path'] }}/.config/systemd/user/kopia-server.service"
|
||||
@@ -276,6 +276,7 @@
|
||||
mode: "0644"
|
||||
validate: "/usr/bin/systemd-analyze verify %s"
|
||||
become: true
|
||||
notify: "notification_restart_kopia_server"
|
||||
|
||||
- name: Enable kopia server service
|
||||
ansible.builtin.systemd:
|
||||
@@ -365,6 +366,18 @@
|
||||
become: true
|
||||
no_log: true
|
||||
|
||||
- name: Check data directory existance
|
||||
ansible.builtin.stat:
|
||||
path: "{{ node['home_path'] }}/data/"
|
||||
register: "is_data_dir"
|
||||
|
||||
- name: Delete lost+found directory on data directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ node['home_path'] }}/data/lost+found/"
|
||||
state: "absent"
|
||||
become: true
|
||||
when: is_data_dir.stat.exists
|
||||
|
||||
- name: Check data directory empty
|
||||
ansible.builtin.find:
|
||||
path: "{{ node['home_path'] }}/data/"
|
||||
@@ -372,6 +385,7 @@
|
||||
hidden: true
|
||||
recurse: false
|
||||
register: "is_data_dir_empty"
|
||||
when: is_data_dir.stat.exists
|
||||
|
||||
- name: Connect kopia server
|
||||
environment:
|
||||
@@ -382,7 +396,7 @@
|
||||
--override-username={{ node['name'] }} \
|
||||
--override-hostname={{ node['name'] }}.{{ domain['internal'] }}
|
||||
become: true
|
||||
when: is_data_dir_empty.matched == 0
|
||||
when: (is_data_dir_empty.matched | default(1)) == 0
|
||||
changed_when: false
|
||||
failed_when: is_kopia_connected.rc != 0
|
||||
register: "is_kopia_connected"
|
||||
@@ -413,7 +427,7 @@
|
||||
{{ node['home_path'] }}/data
|
||||
become: true
|
||||
when:
|
||||
- is_data_dir_empty.matched == 0
|
||||
- (is_data_dir_empty.matched | default(1)) == 0
|
||||
- (is_kopia_connected.rc | default(1)) == 0
|
||||
- (is_snapshot_exist.stdout |
|
||||
default('[]', true) |
|
||||
@@ -431,7 +445,7 @@
|
||||
/usr/bin/kopia repository disconnect
|
||||
become: true
|
||||
when:
|
||||
- is_data_dir_empty.matched == 0
|
||||
- (is_data_dir_empty.matched | default(1)) == 0
|
||||
- (is_kopia_connected.rc | default(1)) == 0
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
- name: Pull image
|
||||
containers.podman.podman_image:
|
||||
name: "docker.io/smallstep/step-ca"
|
||||
tag: "{{ version['containers']['step'] }}"
|
||||
tag: "{{ version['containers']['ca'] }}"
|
||||
state: "present"
|
||||
pull: true
|
||||
|
||||
@@ -85,20 +85,20 @@
|
||||
|
||||
- name: Check container archive images
|
||||
ansible.builtin.stat:
|
||||
path: "{{ node['home_path'] }}/archives/containers/docker.io_smallstep_step-ca_{{ version['containers']['step'] }}.tar"
|
||||
path: "{{ node['home_path'] }}/archives/containers/docker.io_smallstep_step-ca_{{ version['containers']['ca'] }}.tar"
|
||||
register: container_archive_images
|
||||
|
||||
- name: Save container archive images
|
||||
containers.podman.podman_save:
|
||||
image:
|
||||
- "docker.io/smallstep/step-ca:{{ version['containers']['step'] }}"
|
||||
dest: "{{ node['home_path'] }}/archives/containers/docker.io_smallstep_step-ca_{{ version['containers']['step'] }}.tar"
|
||||
- "docker.io/smallstep/step-ca:{{ version['containers']['ca'] }}"
|
||||
dest: "{{ node['home_path'] }}/archives/containers/docker.io_smallstep_step-ca_{{ version['containers']['ca'] }}.tar"
|
||||
format: "oci-archive"
|
||||
force: false
|
||||
when: not container_archive_images.stat.exists
|
||||
|
||||
- name: Fetch container archive images
|
||||
ansible.builtin.fetch:
|
||||
src: "{{ node['home_path'] }}/archives/containers/docker.io_smallstep_step-ca_{{ version['containers']['step'] }}.tar"
|
||||
src: "{{ node['home_path'] }}/archives/containers/docker.io_smallstep_step-ca_{{ version['containers']['ca'] }}.tar"
|
||||
dest: "{{ hostvars['console']['node']['data_path'] }}/images/containers/"
|
||||
flat: true
|
||||
|
||||
Reference in New Issue
Block a user