From 7aafcb3a39d39c72d76c1dd2ec416d2030a4175b Mon Sep 17 00:00:00 2001 From: Daniel Kobras Date: Fri, 29 May 2020 18:32:25 +0200 Subject: [PATCH] Allow multiple aliases for server name --- README.md | 2 +- defaults/main.yml | 2 ++ meta/main.yml | 3 +-- tasks/main.yml | 6 +++--- templates/bbb-ssl.conf.j2 | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 05e8fbe..171131a 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Requires Ansible >= 2.4.0 To get up _BigBlueButton_ up and running the following variables can be configured: - * `bbb_server_name`: Set the FQDN hostname that points to the server where _BigBlueButton_ is going to be installed. This is the only mandatory value, the playbook will fail if this variable is not defined. + * `bbb_server_names`: Set the list of FQDN hostnames that point to the server where _BigBlueButton_ is going to be installed. If only a single FQDN is required, `bbb_server_name` can be used instead. Setting either one of these is the only mandatory value, the playbook will fail if neither variable is defined. * `bbb_configure_firewall`: Configure local UFW firewall on server (Default: `True`). * `bbb_configure_nat`: Configure NAT support for servers behind an external firewall (Default: `False`). * `bbb_configure_ssl`: Configure SSL support using _LetsEncrypt_ certificates (Default: `False`). diff --git a/defaults/main.yml b/defaults/main.yml index c2cbad2..52f6e2d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,6 +12,8 @@ bbb_install_check: False bbb_configure_firewall: True bbb_configure_nat: False bbb_configure_ssl: False +bbb_server_names: + - "{{ bbb_server_name }}" bbb_ssl_webroot_path: /var/www/bigbluebutton-default bbb_ssl_renewal_command_args: '--renew-hook "systemctl restart nginx"' ## Uncoment the following line to test on test network. diff --git a/meta/main.yml b/meta/main.yml index cc306cb..09596c9 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -25,7 +25,6 @@ dependencies: vars: letsencrypt_webroot_path: "{{ bbb_ssl_webroot_path }}" letsencrypt_email: "{{ bbb_ssl_email }}" - letsencrypt_cert_domains: - - "{{ bbb_server_name }}" + letsencrypt_cert_domains: "{{ bbb_server_names }}" bbb_ssl_renewal_command_args: '--renew-hook "systemctl restart nginx"' when: bbb_configure_ssl == True diff --git a/tasks/main.yml b/tasks/main.yml index 0fd6272..ac7cab7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -4,10 +4,10 @@ msg: "OS not supported for BigBlueButton installation" when: ansible_distribution != "Ubuntu" or ansible_distribution_version != "{{ bbb_ubuntu_version }}" -- name: Check if bbb_server_name is defined +- name: Check if primary BigBluebutton server name is defined assert: that: - - bbb_server_name != "" + - bbb_server_names[0] != "" tags: - bbb-check_vars @@ -170,7 +170,7 @@ - install_bbb-check - name: Set BigBlueButton server name - command: bbb-conf --setip "{{ bbb_server_name }}" + command: bbb-conf --setip "{{ bbb_server_names[0] }}" tags: - run_bbb-conf_setip diff --git a/templates/bbb-ssl.conf.j2 b/templates/bbb-ssl.conf.j2 index 6bea4c4..f535786 100644 --- a/templates/bbb-ssl.conf.j2 +++ b/templates/bbb-ssl.conf.j2 @@ -1,11 +1,11 @@ server { listen 80; listen [::]:80; - server_name {{ bbb_server_name }}; + server_name {{ bbb_server_names|join(' ') }}; listen 443 ssl; listen [::]:443 ssl; - ssl_certificate /etc/letsencrypt/live/{{ bbb_server_name }}/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/{{ bbb_server_name }}/privkey.pem; + ssl_certificate /etc/letsencrypt/live/{{ bbb_server_names[0] }}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/{{ bbb_server_names[0] }}/privkey.pem; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2;