Last active
May 30, 2022 18:18
-
-
Save GroverChouT/8c633277a90a362fc136b1c004c85db9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Docker Jitsi Meet Playbook | |
hosts: all | |
become: true | |
vars: | |
path_base: /srv/jitsi-meet | |
path_docker: "{{ path_base }}/docker" | |
path_config: "{{ path_base }}/config" | |
domain: meet.example.com | |
email: owner@example.com | |
tasks: | |
- name: Install Docker Prerequisites | |
ansible.builtin.apt: | |
name: | |
- apt-transport-https | |
- ca-certificates | |
- curl | |
- gnupg | |
- lsb-release | |
state: latest | |
update_cache: true | |
- name: Add Docker Signing Key | |
ansible.builtin.apt_key: | |
url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg" | |
state: present | |
- name: Add Docker Repository | |
ansible.builtin.apt_repository: | |
repo: "deb [arch={{ ansible_architecture }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable" | |
state: present | |
filename: docker | |
- name: Install Docker | |
ansible.builtin.apt: | |
name: | |
- docker | |
- docker.io | |
- docker-compose | |
- docker-registry | |
state: latest | |
update_cache: true | |
- name: Download Docker Jitsi Meet | |
ansible.builtin.get_url: | |
url: https://github.com/jitsi/docker-jitsi-meet/archive/stable-7287.tar.gz | |
dest: /tmp/docker-jitsi-meet.tar.gz | |
- name: Check Docker Jitsi Meet Exists | |
stat: | |
path: "{{ path_base }}" | |
register: register_docker_jitsi_meet | |
- name: Stop Existing Docker Jitsi Meet | |
ansible.builtin.shell: docker-compose down || true | |
args: | |
chdir: "{{ path_docker }}" | |
when: register_docker_jitsi_meet.stat.exists | |
- name: Remove Existing Directories | |
ansible.builtin.file: | |
path: "{{ path_base }}" | |
state: absent | |
when: register_docker_jitsi_meet.stat.exists | |
- name: Create Directories | |
ansible.builtin.file: | |
path: "{{ item }}" | |
state: directory | |
loop: | |
- "{{ path_docker }}" | |
- "{{ path_config }}/web" | |
- "{{ path_config }}/transcripts" | |
- "{{ path_config }}/prosody/config" | |
- "{{ path_config }}/prosody/prosody-plugins-custom" | |
- "{{ path_config }}/jicofo" | |
- "{{ path_config }}/jvb" | |
- "{{ path_config }}/jigasi" | |
- "{{ path_config }}/jibri" | |
- name: Extract Docker Jitsi Meet | |
ansible.builtin.unarchive: | |
src: /tmp/docker-jitsi-meet.tar.gz | |
dest: "{{ path_docker }}" | |
remote_src: yes | |
extra_opts: [--strip-components=1] | |
- name: Generate Environment Variables | |
ansible.builtin.shell: | | |
cp env.example .env | |
./gen-passwords.sh | |
sed -i \ | |
-e "s/CONFIG=.*/CONFIG={{ path_config | regex_replace('/', '\/') }}/" \ | |
-e "s/HTTP_PORT=.*/HTTP_PORT=80/" \ | |
-e "s/HTTPS_PORT=.*/HTTPS_PORT=443/" \ | |
-e "s/TZ=.*/TZ=Asia\/Hong_Kong/" \ | |
-e "s/#PUBLIC_URL=.*/PUBLIC_URL=https:\/\/{{ domain }}/" \ | |
-e "s/#ENABLE_LETSENCRYPT=.*/ENABLE_LETSENCRYPT=1/" \ | |
-e "s/#LETSENCRYPT_DOMAIN=.*/LETSENCRYPT_DOMAIN={{ domain }}/" \ | |
-e "s/#LETSENCRYPT_EMAIL=.*/LETSENCRYPT_EMAIL={{ email }}/" \ | |
-e "s/RESTART_POLICY=.*/RESTART_POLICY=always/" \ | |
.env | |
args: | |
chdir: "{{ path_docker }}" | |
- name: Run Docker Jitsi Meet | |
ansible.builtin.shell: docker-compose up -d | |
args: | |
chdir: "{{ path_docker }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to setup your DNS record and open port
80/tcp
,443/tcp
and10000/udp
. Then run this playbook with: