Skip to content
Snippets Groups Projects
Commit 730c535a authored by Antoine SCHILDKNECHT's avatar Antoine SCHILDKNECHT
Browse files

Merge branch 't33098_update_wowza_role' into 'master'

T33098 update wowza role

See merge request mediaserver/envsetup!26
parents 9124eeb0 fbfbc19a
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ server_instances:
server_celerity_signing_key: "{{ envsetup_celerity_signing_key }}"
server_wowza_url: "{{ envsetup_wowza_url | d('127.0.0.1') }}"
server_wowza_live_pwd: "{{ envsetup_wowza_live_pwd | d() }}"
server_firewall_enabled: true
......
......@@ -110,11 +110,18 @@
touch /etc/mediaserver/.{{ item.ms_server_name }}.reset_service_resources.log ;
creates: /etc/mediaserver/.{{ item.ms_server_name }}.reset_service_resources.log
# Set RTMP password in lives config json
# Set RTMP password and URL in lives config json
# https://stackoverflow.com/questions/50796341/add-a-new-key-value-to-a-json-file-using-ansible
- name: check server_wowza_url variable
fail:
msg: "Please define the Wowza URL/IP (server_wowza_url variable) in your inventory for the \"mediaserver\" group"
when:
- server_wowza_url == "127.0.0.1"
- '"wowza" not in group_names'
- groups['wowza']|d('') | length > 0
- name: ensure lives configuration exists
when: server_wowza_live_pwd | d(false)
copy:
content: "{}"
dest: /etc/mediaserver/lives.json
......@@ -122,25 +129,47 @@
mode: 0644
- name: load lives configuration
when: server_wowza_live_pwd | d(false)
slurp:
src: /etc/mediaserver/lives.json
register: lives_config
- name: store lives configuration in variable
set_fact:
lives_config: "{{ lives_config.content|b64decode|from_json | default([]) }}"
- name: set RTMP password in lives configuration
when: server_wowza_live_pwd | d(false)
vars:
rtmp_pwd_line:
RTMP_PWD: "{{ server_wowza_live_pwd }}"
set_fact:
lives_config: "{{ lives_config.content|b64decode|from_json | default([]) | combine(rtmp_pwd_line) }}"
lives_config: "{{ lives_config | combine(rtmp_pwd_line) }}"
- name: set RTMP url in lives configuration
when:
- server_wowza_url | d(false)
- '"wowza" not in group_names'
vars:
rtmp_publish_url_line:
RTMP_PUBLISH_URL: "rtmp://{{ server_wowza_url }}/%(rtmp_app)s/_definst_?doPublish=%(rtmp_pwd)s/%(stream_id)s"
set_fact:
lives_config: "{{ lives_config | combine(rtmp_publish_url_line) }}"
- name: write lives configuration
when: server_wowza_live_pwd | d(false)
copy:
content: "{{ lives_config | to_nice_json }}"
dest: /etc/mediaserver/lives.json
- name: 'Replace nginx conf to join wowza servers'
when:
- server_wowza_url | d(false)
- '"wowza" not in group_names'
notify: restart nginx
replace:
path: /etc/nginx/conf.d/mediaserver-streaming.conf
regexp: '127\.0\.0\.1'
replace: '{{ server_wowza_url }}'
- name: ensure mediaserver is running
service:
name: mediaserver
......
---
# The conditional base role import here is temporary. The "base" role should be loaded aside from the other roles in the site.yml playbook. RM#33134
- name: import base role if wowza servers is independant
include_role:
name: base
when: '"mediaserver" not in group_names'
- name: install wowza requirements
apt:
force_apt_get: true
......
<?xml version="1.0" encoding="UTF-8"?>
<Root>
<Tune>
<HeapSize>2000M</HeapSize>
<GarbageCollector>${com.wowza.wms.TuningGarbageCollectorG1Default}</GarbageCollector>
<VMOptions>
<VMOption>-server</VMOption>
<VMOption>-Djava.net.preferIPv4Stack=false</VMOption>
</VMOptions>
</Tune>
<Tune>
{% if ansible_memory_mb.real.total >= 15000 %}
<HeapSize>8000M</HeapSize>
{% elif ( ansible_memory_mb.real.total >= 7000 ) %}
<HeapSize>4000M</HeapSize>
{% else %}
<HeapSize>2000M</HeapSize>
{% endif %}
<GarbageCollector>${com.wowza.wms.TuningGarbageCollectorG1Default}</GarbageCollector>
<VMOptions>
<VMOption>-server</VMOption>
<VMOption>-Djava.net.preferIPv4Stack=true</VMOption>
</VMOptions>
</Tune>
</Root>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment