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 state: reloaded
- name: Reload Dovecot - name: Reload Dovecot
command: s6-svc -h /run/service/dovecot command: s6-svc -h {{ s6_scan_dir }}/dovecot
- name: Restart 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 - 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 - name: Create Dovecot service directories
file: file:
path: '/etc/s6-rc/service/{{ item }}' path: '{{ s6_etc_dir }}/service/{{ item }}'
state: directory state: directory
owner: root owner: root
group: wheel group: wheel
@ -76,7 +76,7 @@
- name: Generate Dovecot service scripts - name: Generate Dovecot service scripts
template: template:
dest: '/etc/s6-rc/service/{{ item }}' dest: '{{ s6_etc_dir }}/service/{{ item }}'
src: '{{ item }}.j2' src: '{{ item }}.j2'
mode: 0555 mode: 0555
owner: root owner: root
@ -89,7 +89,7 @@
- name: Generate Dovecot service configuration - name: Generate Dovecot service configuration
copy: copy:
dest: '/etc/s6-rc/service/{{ item.name }}' dest: '{{ s6_etc_dir }}/service/{{ item.name }}'
content: '{{ item.content }}' content: '{{ item.content }}'
mode: 0444 mode: 0444
owner: root owner: root
@ -123,7 +123,7 @@
group: acme group: acme
regexp: '^DEPLOY_DOVECOT_PEM_PATH=' regexp: '^DEPLOY_DOVECOT_PEM_PATH='
state: present 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 - name: Flush handlers
meta: flush_handlers meta: flush_handlers
@ -137,20 +137,20 @@
group: wheel group: wheel
- name: Deploy X.509 certificate to Dovecot - 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: args:
creates: /usr/local/etc/dovecot/fullchain.pem creates: /usr/local/etc/dovecot/fullchain.pem
notify: notify:
- Reload Dovecot - Reload Dovecot
- name: Start 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 register: change
changed_when: change.stdout | length > 0 changed_when: change.stdout | length > 0
- name: Enable Dovecot - name: Enable Dovecot
lineinfile: lineinfile:
path: /etc/s6-rc/service/enabled/contents path: '{{ s6_etc_dir }}/service/enabled/contents'
regexp: "^dovecot$" regexp: "^dovecot$"
line: dovecot line: dovecot
state: present 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