Skip to content

Commit

Permalink
Add Option to configure environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
0x46616c6b committed Dec 11, 2024
1 parent 03285b0 commit 55869cd
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 53 deletions.
8 changes: 5 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ dovecot_postfix_auth: false
dovecot_quota_options: ":ignoreunlimited:noenforcing"
dovecot_quota_storage: 1G

dovecot_userli_path: /vagrant
dovecot_userli_user: vagrant

dovecot_vmail_path: /var/vmail

dovecot_openmetrics_enabled: false
Expand All @@ -63,3 +60,8 @@ dovecot_backup_follower: false

# backup script
dovecot_backup_script_path: "/root/sync_mailboxes_to_remote.sh"

# dovecot systemd environment
dovecot_systemd_environment: |
# Set to '1' to allow Dovecot daemons to produce core dumps
#ALLOW_COREDUMPS=1
2 changes: 2 additions & 0 deletions files/systemd/system/dovecot.service.d/environment.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Service]
EnvironmentFile=/etc/default/dovecot
13 changes: 2 additions & 11 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
pkg: "{{ dovecot_apt_packages }}"
state: present

- name: Import systemd limits tasks
import_tasks: systemd-limits.yml
- name: Import systemd tasks
import_tasks: systemd.yml

- name: Ensure dovecot is in group of userli
user:
Expand All @@ -58,15 +58,6 @@
regexp: "login_greeting ="
notify: Restart dovecot

- name: Copy checkpassword auth config
template:
src: auth-checkpassword.conf.ext.j2
dest: /etc/dovecot/conf.d/auth-checkpassword.conf.ext
owner: root
group: root
mode: 0644
notify: Restart dovecot

- name: Create self-signed ssl cert
when: dovecot_ssl_key is not defined
block:
Expand Down
20 changes: 0 additions & 20 deletions tasks/systemd-limits.yml

This file was deleted.

41 changes: 41 additions & 0 deletions tasks/systemd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
- name: Create systemd drop in directory
file:
path: /etc/systemd/system/dovecot.service.d/
owner: root
group: root
mode: 0755
state: directory

- name: Copy systemd limits drop in
copy:
src: systemd/system/dovecot.service.d/limits.conf
dest: /etc/systemd/system/dovecot.service.d/limits.conf
owner: root
group: root
mode: 0644
notify:
- Reload systemd
- Restart dovecot

- name: Copy environment file
copy:
content: "{{ dovecot_systemd_environment }}"
dest: /etc/default/dovecot
owner: root
group: root
mode: 0640
notify:
- Reload systemd
- Restart dovecot

- name: Copy systemd environment drop in
copy:
src: systemd/system/dovecot.service.d/environment.conf
dest: /etc/systemd/system/dovecot.service.d/environment.conf
owner: root
group: root
mode: 0644
notify:
- Reload systemd
- Restart dovecot
19 changes: 0 additions & 19 deletions templates/auth-checkpassword.conf.ext.j2

This file was deleted.

0 comments on commit 55869cd

Please sign in to comment.