Skip to content
Snippets Groups Projects
main.yml 3.43 KiB
Newer Older
# 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
    install_recommends: false
    name: "{{ wowza_requirements }}"

- name: install wowza
  apt:
    force_apt_get: true
    install_recommends: false
    deb: "{{ wowza_package_url }}"
    state: present

- name: fix wowza init scripts
  loop:
    - /etc/init.d/WowzaStreamingEngine
    - /etc/init.d/WowzaStreamingEngineManager
  replace:
    path: "{{ item }}"
    regexp: '^#### BEGIN INIT INFO$'
    replace: '### BEGIN INIT INFO'

- name: enable wowza service
  systemd:
    name: WowzaStreamingEngine
    enabled: true

- name: disable wowza manager service
  when: not wowza_manager_enabled
  systemd:
    name: WowzaStreamingEngineManager
    enabled: "{{ wowza_manager_enabled }}"
    state: stopped

- name: configure wowza license
  notify: restart wowza
  copy:
    dest: /usr/local/WowzaStreamingEngine/conf/Server.license
    content: "{{ wowza_license }}"

- name: configure wowza manager password
  when: wowza_manager_enabled
  notify: restart wowza manager
  copy:
    dest: /usr/local/WowzaStreamingEngine/conf/admin.password
    content: ubicast {{ wowza_manager_pwd }} admin

- name: fix permissions on wowza logs dir
  notify: restart wowza
  file:
    path: /usr/local/WowzaStreamingEngine/logs
    mode: 0755
    state: directory

- name: ensure live application directory exists
  file:
    path: /usr/local/WowzaStreamingEngine/applications/live
    state: directory

- name: configure wowza live application
  notify: restart wowza
  template:
    src: live-application.xml.j2
    dest: /usr/local/WowzaStreamingEngine/conf/live/Application.xml

- name: configure wowza tunning
  notify: restart wowza
  template:
    src: Tune.xml.j2
    dest: /usr/local/WowzaStreamingEngine/conf/Tune.xml

- name: configure wowza server
  notify: restart wowza
  template:
    src: Server.xml.j2
    dest: /usr/local/WowzaStreamingEngine/conf/Server.xml

- name: configure wowza vhost
  notify: restart wowza
  template:
    src: VHost.xml.j2
    dest: /usr/local/WowzaStreamingEngine/conf/VHost.xml

- name: set wowza manager listening address
  when: wowza_manager_enabled
  notify: restart wowza manager
  replace:
    path: /usr/local/WowzaStreamingEngine/manager/bin/startmgr.sh
    regexp: 'war --httpPort'
    replace: 'war --httpListenAddress={{ wowza_manager_address }} --httpPort'

- name: set wowza manager listening port
  when: wowza_manager_enabled
  notify: restart wowza manager
  replace:
    path: /usr/local/WowzaStreamingEngine/manager/bin/startmgr.sh
    regexp: '--httpPort=\d+'
    replace: '--httpPort={{ wowza_manager_port }}'

- name: logs cleanup cron
  copy:
    dest: /etc/cron.daily/wowza-logs-cleanup
    mode: 0755
    content: |
      #!/bin/bash
      find /usr/local/WowzaStreamingEngine/logs/ -type f -mtime +{{ wowza_logs_retention }} -delete

# FIREWALL

- name: firewall
Stéphane Diemer's avatar
Stéphane Diemer committed
  when: wowza_firewall_enabled
  vars:
    ferm_rules_filename: "{{ wowza_ferm_rules_filename }}"
    ferm_input_rules: "{{ wowza_ferm_input_rules }}"
    ferm_output_rules: "{{ wowza_ferm_output_rules }}"
    ferm_global_settings: "{{ wowza_ferm_global_settings }}"
  include_role:
- meta: flush_handlers