ansible/roles/prosody/tasks/main.yml

49 lines
1.5 KiB
YAML

---
- name: Enable backports
apt_repository: repo='deb http://deb.debian.org/debian buster-backports main'
# debian is too stupid to fix this in stable: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914536
- name: Install lua-cyrussasl from backports
apt: name=lua-cyrussasl default_release=buster-backports
- name: Install prosody
apt:
name:
- prosody
- libsasl2-modules-ldap
- sasl2-bin
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/prosody/certs/{{ prosody_domain }}.key -out /etc/prosody/certs/{{ prosody_domain }}.crt -days 730 -subj "/CN={{ prosody_domain }}" creates=/etc/prosody/certs/{{ prosody_domain }}.crt
- name: Ensure prosody is in sasl group
user: name=prosody groups=sasl
- name: Ensure sasl configuration directory exists
file: path=/etc/sasl/ state=directory
- name: Configure sasl
copy: src={{ item }} dest=/etc/{{ item }}
with_items:
- default/saslauthd
- sasl/xmpp.conf
- name: Configure sasl
template: src=saslauthd.conf.j2 dest=/etc/saslauthd.conf
notify: Restart saslauthd
- name: Configure prosody
template: src=prosody.cfg.lua.j2 dest=/etc/prosody/prosody.cfg.lua
notify: Restart prosody
- name: Configure certificate manager
template: src=certs.j2 dest=/etc/acertmgr/{{ prosody_domain }}_prosody.conf
notify: Run acertmgr
- name: Start saslauthd
service: name=saslauthd state=started enabled=yes
- name: Start prosody
service: name=prosody state=started enabled=yes