Use s6 path variables for Dovecot

Updates #31
This commit is contained in:
Crest 2022-07-04 02:44:47 +02:00
parent 803ebdbded
commit b9d4e0b0d0
3 changed files with 11 additions and 11 deletions

View File

@ -5,10 +5,10 @@
state: reloaded
- name: Reload Dovecot
command: s6-svc -h /run/service/dovecot
command: s6-svc -h {{ s6_scan_dir }}/dovecot
- name: Restart Dovecot
command: s6-svc -wR -T 5000 -ru /run/service/dovecot
command: s6-svc -wR -T 5000 -ru {{ s6_scan_dir }}/dovecot
- name: Restart Dovecot log
command: s6-svc -wR -T 5000 -ru /run/service/dovecot-log
command: s6-svc -wR -T 5000 -ru {{ s6_scan_dir }}/dovecot-log

View File

@ -63,7 +63,7 @@
- name: Create Dovecot service directories
file:
path: '/etc/s6-rc/service/{{ item }}'
path: '{{ s6_etc_dir }}/service/{{ item }}'
state: directory
owner: root
group: wheel
@ -76,7 +76,7 @@
- name: Generate Dovecot service scripts
template:
dest: '/etc/s6-rc/service/{{ item }}'
dest: '{{ s6_etc_dir }}/service/{{ item }}'
src: '{{ item }}.j2'
mode: 0555
owner: root
@ -89,7 +89,7 @@
- name: Generate Dovecot service configuration
copy:
dest: '/etc/s6-rc/service/{{ item.name }}'
dest: '{{ s6_etc_dir }}/service/{{ item.name }}'
content: '{{ item.content }}'
mode: 0444
owner: root
@ -123,7 +123,7 @@
group: acme
regexp: '^DEPLOY_DOVECOT_PEM_PATH='
state: present
line: 'DEPLOY_DOVECOT_RELOAD="sudo s6-svc -h /run/service/dovecot"'
line: 'DEPLOY_DOVECOT_RELOAD="sudo s6-svc -h {{ s6_scan_dir }}/dovecot"'
- name: Flush handlers
meta: flush_handlers
@ -137,20 +137,20 @@
group: wheel
- name: Deploy X.509 certificate to Dovecot
command: 'env sudo -Hu acme acme.sh --debug --home /var/db/acme --install-cert --domain {{ ansible_fqdn }} --cert-file /usr/local/etc/dovecot/cert.pem --key-file /usr/local/etc/dovecot/privkey.pem --fullchain-file /usr/local/etc/dovecot/fullchain.pem --reloadcmd "sudo s6-svc -h /run/service/dovecot"'
command: 'env sudo -Hu acme acme.sh --debug --home /var/db/acme --install-cert --domain {{ ansible_fqdn }} --cert-file /usr/local/etc/dovecot/cert.pem --key-file /usr/local/etc/dovecot/privkey.pem --fullchain-file /usr/local/etc/dovecot/fullchain.pem --reloadcmd "sudo s6-svc -h {{ s6_scan_dir }}/dovecot"'
args:
creates: /usr/local/etc/dovecot/fullchain.pem
notify:
- Reload Dovecot
- name: Start Dovecot
command: fdmove -c 2 1 s6-rc -u -v 2 -t 15000 change dovecot
command: fdmove -c 2 1 s6-rc -l {{ s6_live_dir }} -u -v 2 -t 15000 change dovecot
register: change
changed_when: change.stdout | length > 0
- name: Enable Dovecot
lineinfile:
path: /etc/s6-rc/service/enabled/contents
path: '{{ s6_etc_dir }}/service/enabled/contents'
regexp: "^dovecot$"
line: dovecot
state: present

View File

@ -1 +1 @@
acme ALL=NOPASSWD:/usr/local/bin/s6-svc -h /run/service/dovecot
acme ALL=NOPASSWD:/usr/local/bin/s6-svc -h {{ s6_scan_dir }}/dovecot