Compare commits

...

1 Commits

Author SHA1 Message Date
d28f793ad9 mailpit as utility v1 2025-06-17 13:13:01 +08:00
5 changed files with 50 additions and 0 deletions

View File

@ -12,6 +12,8 @@
# php_version: "8.3" # Must match one of your project's PHP versions
# redis:
# enabled: false
# mailpit:
# enabled: false # Fake SMTP server to catch and view emails sent during local dev
# db_engine:
# Choose between mariadb, mysql, or postgresql. Lenvi will install and manage the correct service.
@ -38,6 +40,8 @@ utilities:
php_version: "8.3"
redis:
enabled: false
mailpit:
enabled: false
# 🛢️ Database Engine
db_engine: "mariadb"

View File

@ -21,4 +21,6 @@
when: utilities.phpmyadmin.enabled is defined and utilities.phpmyadmin.enabled
- role: redis
when: utilities.redis.enabled is defined and utilities.redis.enabled
- role: mailpit
when: utilities.mailpit.enabled is defined and utilities.mailpit.enabled
- role: projects

View File

@ -0,0 +1,6 @@
---
- name: "Restart Mailpit service"
ansible.builtin.systemd:
name: mailpit
daemon_reload: yes
state: restarted

View File

@ -0,0 +1,24 @@
---
- name: "Install Mailpit using the official installation script"
ansible.builtin.shell: "bash <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh)"
args:
creates: /usr/local/bin/mailpit
register: mailpit_install
changed_when: "mailpit_install.rc == 0 and 'Installed Mailpit to' in mailpit_install.stdout"
become: yes
- name: "Create Mailpit systemd service file"
ansible.builtin.template:
src: mailpit.service.j2
dest: /etc/systemd/system/mailpit.service
owner: root
group: root
mode: '0644'
notify: Restart Mailpit service
- name: "Ensure Mailpit service is enabled and started"
ansible.builtin.systemd:
name: mailpit
enabled: yes
state: started
daemon_reload: yes

View File

@ -0,0 +1,14 @@
[Unit]
Description=Mailpit
After=network.target
[Service]
User={{ ansible_user_id }}
Group={{ ansible_user_gid }}
Type=simple
ExecStart=/usr/local/bin/mailpit
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target