From b34394cfb0b0824da701a3e4cc6b5b2aa533ba01 Mon Sep 17 00:00:00 2001 From: Sebastian Preisner Date: Fri, 5 Jan 2024 09:39:17 +0100 Subject: [PATCH] switch modules to fqdn --- tasks/docker.yml | 23 +++++---- tasks/firewall.yml | 15 +++--- tasks/letsencrypt.yml | 4 +- tasks/main.yml | 112 ++++++++++++++++++++++-------------------- tasks/nat.yml | 14 +++--- tasks/sip.yml | 10 ++-- tasks/ssl.yml | 24 ++++----- 7 files changed, 104 insertions(+), 98 deletions(-) diff --git a/tasks/docker.yml b/tasks/docker.yml index f3c8ba6..ba21422 100644 --- a/tasks/docker.yml +++ b/tasks/docker.yml @@ -1,6 +1,6 @@ --- - name: Enable https support for apt - apt: + ansible.builtin.apt: name: apt-transport-https state: present tags: @@ -8,7 +8,7 @@ - docker - name: Check Docker apt key is present - apt_key: + ansible.builtin.apt_key: url: https://download.docker.com/linux/ubuntu/gpg state: present tags: @@ -16,14 +16,14 @@ - docker - name: Check Docker repo is enabled - apt_repository: repo="deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" state=present + ansible.builtin.apt_repository: repo="deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" state=present tags: - docker-repositories - repositories - docker - name: Check Docker packages are installed - apt: + ansible.builtin.apt: name: - docker-ce - docker-ce-cli @@ -34,20 +34,23 @@ - docker - name: Enable Docker daemon on startup - systemd: name="docker" enabled=True state="started" + ansible.builtin.systemd: + name: "docker" + enabled: true + state: started tags: - enable_docker - docker - name: Set download location for desired docker-compose version - set_fact: + ansible.builtin.set_fact: docker_compose_download_url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64 when: docker_compose_version is defined and docker_compose_version != "latest" tags: - docker-compose - name: Determine latest upstream release for docker-compose - uri: + ansible.builtin.uri: url: https://api.github.com/repos/docker/compose/releases/latest register: docker_compose_latest_json when: docker_compose_download_url is undefined @@ -55,14 +58,14 @@ - docker-compose - name: Extract download location for latest docker-compose - set_fact: + ansible.builtin.set_fact: docker_compose_download_url: "{{ docker_compose_latest_json.json.assets | selectattr('name', 'equalto', 'docker-compose-Linux-x86_64') | map(attribute='browser_download_url') | first | string }}" when: docker_compose_download_url is undefined tags: - docker-compose - name: Install up-to-date docker-compose - get_url: + ansible.builtin.get_url: url: "{{ docker_compose_download_url }}" dest: "/usr/local/bin/docker-compose" owner: root @@ -73,7 +76,7 @@ - docker-compose - name: Remove outdated docker-compose from distribution - apt: + ansible.builtin.apt: name: docker-compose state: absent tags: diff --git a/tasks/firewall.yml b/tasks/firewall.yml index ad44730..a406d27 100644 --- a/tasks/firewall.yml +++ b/tasks/firewall.yml @@ -1,27 +1,27 @@ --- - name: Install UFW firewall - apt: + ansible.builtin.apt: name: ufw state: present tags: - bbb_configure_ufw - name: Allow OpenSSH access in firewall - ufw: + community.general.ufw: rule: allow name: OpenSSH tags: - bbb_configure_ufw - name: Allow HTTP/HTTPS access in firewall - ufw: + community.general.ufw: rule: allow name: "Nginx Full" tags: - bbb_configure_ufw - name: Allow media connections in firewall - ufw: + community.general.ufw: rule: allow proto: udp port: 16384:32768 @@ -29,21 +29,20 @@ - bbb_configure_ufw - name: Allow connections from SIP gateways in firewall - ufw: + community.general.ufw: rule: allow from: "{{ lookup('dig', item[0]) }}" port: "5060,5080" proto: "{{ item[1] }}" comment: "SIP gateway" loop: "{{ bbb_sip_providers.values() | map(attribute='proxy') | product(['tcp', 'udp']) | list }}" - when: bbb_sip_providers is defined + when: bbb_sip_providers is defined tags: - bbb_configure_ufw - name: Enable firewall rules - ufw: + community.general.ufw: state: enabled policy: deny tags: - bbb_enable_ufw - diff --git a/tasks/letsencrypt.yml b/tasks/letsencrypt.yml index f5b2090..b30442c 100644 --- a/tasks/letsencrypt.yml +++ b/tasks/letsencrypt.yml @@ -1,6 +1,6 @@ --- - name: Create nginx SSL certificates directory - file: + ansible.builtin.file: state: directory path: /etc/nginx/ssl owner: root @@ -9,6 +9,6 @@ - bbb_letsencript_ssl_dir - name: Create dhparam SSL file - command: openssl dhparam -dsaparam -out /etc/nginx/ssl/dhp-4096.pem 4096 creates=/etc/nginx/ssl/dhp-4096.pem + ansible.builtin.command: openssl dhparam -dsaparam -out /etc/nginx/ssl/dhp-4096.pem 4096 creates=/etc/nginx/ssl/dhp-4096.pem tags: - bbb_create_dhpem_file diff --git a/tasks/main.yml b/tasks/main.yml index 4516e6b..650d0b5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Check if OS is supported - fail: + ansible.builtin.fail: msg: "OS not supported for BigBlueButton installation" when: ansible_distribution != "Ubuntu" or ansible_distribution_version != "{{ bbb_ubuntu_version }}" @@ -11,50 +11,50 @@ tags: - bbb-check_vars -- name: Enable https support for apt - apt: - name: apt-transport-https +- name: Enable https support for ansible.builtin.apt + ansible.builtin.apt: + name: ansible.builtin.apt-transport-https state: present tags: - - apt_transport_https + - ansible.builtin.apt_transport_https -- name: Update apt cache - apt: update_cache=yes +- name: Update ansible.builtin.apt cache + ansible.builtin.apt: update_cache=yes tags: - - update_apt_cache + - update_ansible.builtin.apt_cache - name: Install BigBluebutton required packages - apt: name={{ item }} state=present + ansible.builtin.apt: name={{ item }} state=present with_items: - language-pack-en - software-properties-common tags: - bbb-dependencies -- name: Check python-apt is present - apt: name=python-apt state=present +- name: Check python-ansible.builtin.apt is present + ansible.builtin.apt: name=python-ansible.builtin.apt state=present tags: - bbb-role_dependencies - name: Update locale (ensure LANG=en_US.UTF-8) - lineinfile: dest=/etc/default/locale regexp=^LANG line='LANG=en_US.UTF-8' + ansible.builtin.lininfile: dest=/etc/default/locale regexp=^LANG line='LANG=en_US.UTF-8' tags: - set_locale - name: Update locale (ensure LC_ALL is absent) - lineinfile: dest=/etc/default/locale regexp=^LC_ALL state=absent + ansible.builtin.lininfile: dest=/etc/default/locale regexp=^LC_ALL state=absent tags: - set_locale -- name: Check BigBlueButton apt key is present - apt_key: +- name: Check BigBlueButton ansible.builtin.apt key is present + ansible.builtin.apt_key: url: https://ubuntu.bigbluebutton.org/repo/bigbluebutton.asc state: present tags: - - bbb-apt_key + - bbb-ansible.builtin.apt_key -- name: Check multiverse apt repositories are enabled - apt_repository: repo={{ item }} state=present +- name: Check multiverse ansible.builtin.apt repositories are enabled + ansible.builtin.apt_repository: repo={{ item }} state=present with_items: - 'deb http://archive.ubuntu.com/ubuntu xenial multiverse' - 'deb-src http://archive.ubuntu.com/ubuntu xenial multiverse' @@ -65,7 +65,7 @@ - repositories - name: Check supplemental PPA repos are enabled - apt_repository: repo={{ item }} state=present + ansible.builtin.apt_repository: repo={{ item }} state=present with_items: - 'ppa:bigbluebutton/support' - 'ppa:rmescandon/yq' @@ -74,55 +74,55 @@ - repositories - name: Check BigBlueButton repo is enabled - apt_repository: repo={{ item }} state=present + ansible.builtin.apt_repository: repo={{ item }} state=present with_items: - - 'deb {{ bbb_apt_repo_url }} bigbluebutton-xenial main' + - 'deb {{ bbb_ansible.builtin.apt_repo_url }} bigbluebutton-xenial main' tags: - bbb-repositories - repositories # BigBlueButton UFW firewall configuration -- include_tasks: firewall.yml +- ansible.builtin.include_tasks: firewall.yml when: bbb_configure_firewall == True tags: - firewall - name: Check BigBlueButton is installed - apt: name=bigbluebutton state=present + ansible.builtin.apt: name=bigbluebutton state=present tags: - install_bbb -- name: Check MongoDB apt key is present - apt_key: +- name: Check MongoDB ansible.builtin.apt key is present + ansible.builtin.apt_key: url: "https://www.mongodb.org/static/pgp/server-3.4.asc" state: present when: bbb_install_html5 == True tags: - - mongodb-apt_key + - mongodb-ansible.builtin.apt_key - name: Check MongoDB repo is enabled - apt_repository: repo="deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" state=present + ansible.builtin.apt_repository: repo="deb [ arch=amd64,arm64 ] http://repo.mongodb.org/ansible.builtin.apt/ubuntu xenial/mongodb-org/3.4 multiverse" state=present when: bbb_install_html5 == True tags: - mongodb-repositories - repositories -- name: Check NodeJS apt key is present - apt_key: +- name: Check NodeJS ansible.builtin.apt key is present + ansible.builtin.apt_key: url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" state: present when: bbb_install_html5 == True tags: - - nodejs-apt_key + - nodejs-ansible.builtin.apt_key - name: Check NodeJS repo is enabled - apt_repository: repo="deb https://deb.nodesource.com/node_8.x xenial main" state=present + ansible.builtin.apt_repository: repo="deb https://deb.nodesource.com/node_8.x xenial main" state=present when: bbb_install_html5 == True tags: - nodejs-repositories - repositories - name: Install bbb-html5 and dependencies - apt: + ansible.builtin.apt: name: - bbb-html5 - mongodb-org @@ -134,48 +134,48 @@ - install_bbb-html5 - name: Install notes playback package - apt: name=bbb-playback-notes state=present + ansible.builtin.apt: name=bbb-playback-notes state=present when: bbb_install_playback_notes == True tags: - install_bbb-playback-notes - name: Install podcast playback package - apt: name=bbb-playback-podcast state=present + ansible.builtin.apt: name=bbb-playback-podcast state=present when: bbb_install_playback_podcast == True tags: - install_bbb-playback-podcast - name: Install screenshare playback package - apt: name=bbb-playback-screenshare state=present + ansible.builtin.apt: name=bbb-playback-screenshare state=present when: bbb_install_playback_screenshare == True tags: - install_bbb-playback-screenshare - name: Install bbb webhooks package - apt: name=bbb-webhooks state=present + ansible.builtin.apt: name=bbb-webhooks state=present when: bbb_install_webhooks == True tags: - install_bbb-webhooks - name: Install bbb-demo package - apt: name=bbb-demo state=present + ansible.builtin.apt: name=bbb-demo state=present when: bbb_install_demo == True tags: - install_bbb-demo - name: Install bbb-check package - apt: name=bbb-check state=present + ansible.builtin.apt: name=bbb-check state=present when: bbb_install_check == True tags: - install_bbb-check - name: Set BigBlueButton server name - command: bbb-conf --setip "{{ bbb_server_names[0] }}" + ansible.builtin.command: bbb-conf --setip "{{ bbb_server_names[0] }}" tags: - run_bbb-conf_setip - name: Get server local IP address - set_fact: + ansible.builtin.set_fact: server_ip: "{{ ansible_default_ipv4.address }}" tags: - bbb-get_local_ip @@ -187,28 +187,28 @@ - bbb-get_public_ip - name: Get server public IP address - set_fact: + ansible.builtin.set_fact: public_ip: "{{ public_ip.ansible_facts.ipify_public_ip }}" tags: - bbb-get_public_ip - name: Verify local IP vs public IP addresses - set_fact: + ansible.builtin.set_fact: internal_ip: "{{ server_ip }}" when: server_ip != public_ip tags: - bbb-check_server_ip - name: Verify local IP vs public IP addresses - set_fact: + ansible.builtin.set_fact: server_ip: "{{ public_ip }}" when: server_ip != public_ip tags: - bbb-check_server_ip - name: Update BwMon server IP address - replace: + ansible.builtin.replace: path: /var/www/bigbluebutton/client/conf/config.xml regexp: '
To join this meeting by phone, dial:
%%DIALNUM%%
Then enter %%CONFNUM%% as the conference PIN number.") }}' diff --git a/tasks/ssl.yml b/tasks/ssl.yml index bbb3dcd..bf2606a 100644 --- a/tasks/ssl.yml +++ b/tasks/ssl.yml @@ -1,13 +1,13 @@ --- - name: Check if bbb_ssl_email is defined - assert: + ansible.builtin.assert: that: - bbb_ssl_email != "" tags: - bbb-check_vars1 - name: Install LetsEncrypt enabled nginx config - template: + ansible.builtin.template: src: templates/bbb-ssl.conf.j2 dest: /etc/nginx/sites-available/bigbluebutton backup: yes @@ -15,7 +15,7 @@ - bbb_install_nginx_ssl_conf - name: Update http for https on nginx - replace: + ansible.builtin.replace: path: /opt/freeswitch/conf/sip_profiles/external.xml regexp: '' replace: '' @@ -24,7 +24,7 @@ - bbb_enable_https - name: Update http for https on nginx - replace: + ansible.builtin.replace: path: /etc/bigbluebutton/nginx/sip.nginx regexp: 'http:' replace: 'https:' @@ -33,7 +33,7 @@ - bbb_enable_https - name: Update SIP port on nginx - replace: + ansible.builtin.replace: path: /etc/bigbluebutton/nginx/sip.nginx regexp: '5066' replace: '7443' @@ -42,7 +42,7 @@ - bbb_enable_https - name: Update http for https on BigBlueButton webapp - replace: + ansible.builtin.replace: path: "/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties" regexp: 'bigbluebutton.web.serverURL=http:' replace: 'bigbluebutton.web.serverURL=https:' @@ -51,7 +51,7 @@ - bbb_enable_https - name: Update http for https on red5 - replace: + ansible.builtin.replace: path: /usr/share/red5/webapps/screenshare/WEB-INF/screenshare.properties regexp: 'jnlpUrl=http:' replace: 'jnlpUrl=https:' @@ -60,7 +60,7 @@ - bbb_enable_https - name: Update http for https on red5 - replace: + ansible.builtin.replace: path: /usr/share/red5/webapps/screenshare/WEB-INF/screenshare.properties regexp: 'jnlpFile=http:' replace: 'jnlpFile=https:' @@ -69,7 +69,7 @@ - bbb_enable_https - name: Update http for https on BigBlueButton client config - replace: + ansible.builtin.replace: path: /var/www/bigbluebutton/client/conf/config.xml regexp: 'http://' replace: 'https://' @@ -78,7 +78,7 @@ - bbb_enable_https - name: Update http for https on BigBlueButton client config - replace: + ansible.builtin.replace: path: /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml regexp: 'playback_protocol: http$' replace: 'playback_protocol: https' @@ -87,14 +87,14 @@ - bbb_enable_https - name: Ansible check if /var/lib/tomcat7/webapps/demo/bbb_api_conf.jsp exists - stat: + ansible.builtin.stat: path: /var/lib/tomcat7/webapps/demo/bbb_api_conf.jsp register: demo tags: - bbb_enable_https - name: Update http for https on demo - replace: + ansible.builtin.replace: path: /var/lib/tomcat7/webapps/demo/bbb_api_conf.jsp regexp: 'String BigBlueButtonURL = "http:' replace: 'String BigBlueButtonURL = "https:'