summaryrefslogtreecommitdiff
path: root/roles/streaming/rtmp/streamer/tasks/main.yml
blob: 1715bdf990569c636493c5caa31ebf65c35850cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
- name: prepare rtmp-streamer storage volume
  when: rtmp_streamer_storage is defined
  vars:
    storage_volume: "{{ rtmp_streamer_storage | combine({'dest': rtmp_streamer_base_path}) }}"
  include_role:
    name: "storage/{{ rtmp_streamer_storage.type }}/volume"

- name: create rtmp-streamer instance directory
  file:
    path: "{{ rtmp_streamer_base_path }}/{{ rtmp_streamer_inst_name }}"
    state: directory

- name: generate nginx config
  template:
    src: nginx.conf.j2
    dest: "{{ rtmp_streamer_base_path }}/{{ rtmp_streamer_inst_name }}/nginx.conf"

- name: generate streamer config
  copy:
    content: "{{ rtmp_streamer_config | combine({'rtmp_base_url': 'rtmp://127.0.0.1/'+rtmp_streamer_app_name}) | to_nice_yaml }}\n"
    dest: "{{ rtmp_streamer_base_path }}/{{ rtmp_streamer_inst_name }}/config.yml"

- name: create recording directory
  when: rtmp_streamer_recording is defined
  file:
    path: "{{ rtmp_streamer_base_path }}/{{ rtmp_streamer_inst_name }}/recordings"
    state: directory
    owner: app
    group: app

- name: install pod manifest
  vars:
    kubernetes_standalone_pod:
      name: "rtmp-streamer-{{ rtmp_streamer_inst_name }}"
      spec: "{{ lookup('template', 'pod-spec.yml.j2') }}"
      config_hash_items:
      - path: "{{ rtmp_streamer_base_path }}/{{ rtmp_streamer_inst_name }}/nginx.conf"
        properties:
        - checksum
      - path: "{{ rtmp_streamer_base_path }}/{{ rtmp_streamer_inst_name }}/config.yml"
        properties:
        - checksum
  include_role:
    name: kubernetes/standalone/pod