infra/roles/coturn/tasks/coturn.yml

70 lines
1.3 KiB
YAML

---
- name: install certs if tls is used
copy:
src: "/usr/local/etc/letsencrypt/live/{{ item }}"
dest: "/usr/local/etc/certs/"
owner: root
group: root
mode: 0755
tags:
- letsencrypt-certs
notify: restart coturn
when: coturn_tls|bool == true
vars:
prediff_cmd: echo
with_items:
- "{{ coturn_url }}"
- name: cert files if tls is used
file:
path: "/usr/local/etc/letsencrypt/live/{{ item }}"
state: absent
tags:
- letsencrypt-certs
notify: restart coturn
when: coturn_tls|bool == false
vars:
prediff_cmd: echo
with_items:
- "{{ coturn_url }}"
# coturn isnt in the ubuntu 22.04 repos because of this bug:
# https://bugs.launchpad.net/ubuntu/+source/coturn/+bug/1967018
#
# using the ppa instead
- name: install coturn
apt:
name: coturn
state: latest
update_cache: true
notify: restart coturn
tags:
- packages
- name: ensure log dir ownership
file:
state: directory
path: /var/log/turnserver
owner: turnserver
group: turnserver
- name: template coturn config
template:
src: turnserver.conf.j2
dest: /etc/turnserver.conf
owner: root
group: turnserver
mode: "0640"
tags:
- coturn-config
- turnserver.conf
notify: restart coturn
- name: enable and start coturn
service:
name: coturn
state: started
enabled: true