Skip to content

Commit

Permalink
Merge pull request #9 from ebbba-org/fix/#8
Browse files Browse the repository at this point in the history
Fixup include_tasks
  • Loading branch information
BrutalBirdie authored Dec 20, 2023
2 parents b9db168 + 34a555c commit 1079a89
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 46 deletions.
5 changes: 0 additions & 5 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,3 @@
exclude_paths:
- .cache/
- .github/
warn_list:
- package-latest
skip_list:
- fqcn-builtins
- internal-error
8 changes: 4 additions & 4 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---

- name: systemd daemon-reload
systemd:
- name: Systemd daemon-reload
ansible.legacy.systemd:
daemon_reload: yes

- name: restart coturn
service:
- name: Restart coturn
ansible.legacy.service:
name: coturn
state: restarted
1 change: 1 addition & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
galaxy_info:
role_name: coturn
company: eBBBa
namespace: ebbba
author: BrutalBirdie
description: >
Coturn for BigBlueButton installation (following the documentation on
Expand Down
10 changes: 6 additions & 4 deletions tasks/firewalld.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

- name: firewalld enable coturn standard ports
firewalld:
- name: Firewalld enable coturn standard ports
ansible.posix.firewalld:
port: "{{ item.port }}/{{ item.proto }}"
permanent: yes
state: enabled
Expand All @@ -12,13 +12,15 @@
proto: udp
- port: "{{ coturn_min_port }}-{{ coturn_max_port }}"
proto: udp
notify: restart coturn

- name: firewalld enable coturn tls ports
firewalld:
- name: Firewalld enable coturn tls ports
ansible.posix.firewalld:
port: item
permanent: yes
state: enabled
loop:
- "{{ coturn_tls_listening_port }}/tcp"
- "{{ coturn_tls_listening_port }}/udp"
when: coturn_use_tls
notify: restart coturn
44 changes: 21 additions & 23 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
---

- name: Install coturn
package:
ansible.legacy.package:
name: coturn
state: "{{ coturn_install_state }}"

- name: Manage tls permissions
when: coturn_tls_group is defined
block:
- name: Fail if tls should be used but required values are not set
assert:
ansible.legacy.assert:
that:
- coturn_tls_listening_port is defined and coturn_tls_listening_port is truthy
- coturn_tls_cert_dir is defined and coturn_tls_cert_dir is truthy
- coturn_tls_cert is defined and coturn_tls_cert is truthy
- coturn_tls_key is defined and coturn_tls_key is truthy
- name: Add turnserver user to TLS group
user:
ansible.legacy.user:
name: "{{ turn_user }}"
groups: "{{ coturn_tls_group }}"
append: true
when: coturn_tls_group is defined

- name: Get file info of TLS Folder
stat:
ansible.legacy.stat:
path: "{{ coturn_tls_cert_dir }}"
register: stat_coturn_tls_cert_dir

- name: Get info of cert post hooks folder
stat:
ansible.legacy.stat:
path: /etc/letsencrypt/renewal-hooks/post
register: certbot_post_hooks

- name: Get info of cert pre hooks folder
stat:
ansible.legacy.stat:
path: /etc/letsencrypt/renewal-hooks/post
register: certbot_pre_hooks

- name: Grant turnserver user access to certificate folder
acl:
ansible.posix.acl:
path: "{{ coturn_tls_cert_dir }}"
entity: "{{ turn_user }}"
etype: user
Expand All @@ -47,7 +47,7 @@
when: stat_coturn_tls_cert_dir.stat.exists

- name: Setup certbot pre hooks
template:
ansible.legacy.template:
src: "{{ item }}"
dest: "/etc/letsencrypt/renewal-hooks/pre/{{ item | basename | regex_replace('\\.j2$', '') }}.sh"
owner: "root"
Expand All @@ -58,7 +58,7 @@
when: certbot_pre_hooks.stat.exists

- name: Setup certbot post hooks
template:
ansible.legacy.template:
src: "{{ item }}"
dest: "/etc/letsencrypt/renewal-hooks/post/{{ item | basename | regex_replace('\\.j2$', '') }}.sh"
owner: "root"
Expand All @@ -69,23 +69,23 @@
when: certbot_post_hooks.stat.exists

- name: Copy Diffie-Hellmann parameter (from https://ssl-config.mozilla.org/ffdhe2048.txt)
copy:
ansible.legacy.copy:
src: dhparam.pem
dest: /etc/dhparam.pem
owner: root
group: root
mode: '0644'
when: coturn_use_tls
when: coturn_use_tls

- name: Create systemd override for coturn
block:
- name: Create needed folder
file:
ansible.legacy.file:
path: /etc/systemd/system/coturn.service.d/
state: directory
mode: '0755'
- name: Copy coturn systemd override file
copy:
ansible.legacy.copy:
src: override.conf
dest: /etc/systemd/system/coturn.service.d/override.conf
owner: root
Expand All @@ -98,35 +98,33 @@
- name: Create lograte structure
block:
- name: Create needed folder
file:
ansible.legacy.file:
path: /var/log/turnserver
owner: "{{ turn_user }}"
group: "{{ turn_user }}"
state: directory
mode: '0755'
- name: Copy logrotate config
copy:
ansible.legacy.copy:
src: logging.conf
dest: /etc/logrotate.d/coturn
owner: root
group: root
mode: '0644'

- name: Configure coturn
template:
ansible.legacy.template:
src: turnserver.conf.j2
dest: /etc/turnserver.conf
owner: root
group: root
mode: 0644
notify: restart coturn

- name: configure firewall on ubuntu
include: ufw.yml
- name: Configure firewall on ubuntu
ansible.legacy.include_tasks: ufw.yml
when: ansible_os_family == 'Debian'
notify: restart coturn

- name: configure firewall on Centos
include: firewalld.yml
- name: Configure firewall on Centos
ansible.legacy.include_tasks: firewalld.yml
when: ansible_os_family == 'RedHat'
notify: restart coturn
22 changes: 12 additions & 10 deletions tasks/ufw.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---

- name: install dependencies
apt:
- name: Install dependencies
ansible.legacy.apt:
update_cache: true
name: ufw

- name: ufw allow known services
ufw:
- name: UFW allow known services
community.general.ufw:
rule: allow
name: OpenSSH

- name: ufw allow coturn standard ports
ufw:
- name: UFW allow coturn standard ports
community.general.ufw:
rule: allow
port: "{{ item.port }}"
proto: "{{ item.proto }}"
Expand All @@ -22,9 +22,10 @@
proto: udp
- port: "{{ coturn_min_port }}:{{ coturn_max_port }}"
proto: udp
notify: restart coturn

- name: ufw allow coturn tls port
ufw:
- name: UFW allow coturn tls port
community.general.ufw:
rule: allow
port: "{{ item.port }}"
proto: "{{ item.proto }}"
Expand All @@ -34,9 +35,10 @@
- port: "{{ coturn_tls_listening_port }}"
proto: udp
when: coturn_use_tls
notify: restart coturn

- name: enable firewall
ufw:
- name: Enable firewall
community.general.ufw:
state: enabled
policy: reject
logging: off

0 comments on commit 1079a89

Please sign in to comment.