summaryrefslogtreecommitdiffstats
path: root/roles/stream/tasks/main.yml
blob: 76febe0e20a975dc0b56087bb7306a5208ea641d (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
- name: Install Icecast
  become: true
  package:
    name: icecast2
    state: present
- name: Set up config
  become: true
  template:
    src: icecast.xml
    dest: /etc/icecast2/icecast-emacsconf.xml
- name: Create restream dir
  file:
    path: "{{ icecast_restream_dir }}"
    owner: "{{ icecast_user }}"
    state: directory
- name: Debug
  debug:
    var: item.id
  loop: "{{ emacsconf_tracks }}"
- name: Copy the lowres restreaming shell script
  template:
    src: lowres.sh
    dest: /usr/local/bin/{{ emacsconf_id }}-lowres-{{ item.id }}.sh
    mode: 0755
  loop: "{{ emacsconf_tracks }}"
- name: Copy lowres on-connect
  template:
    src: on-connect
    dest: /usr/local/bin/{{ emacsconf_id }}-lowres-{{ item.id }}-on-connect
    mode: 0755
  loop: "{{ emacsconf_tracks }}"
- name: Copy lowres on-disconnect
  template:
    src: on-disconnect
    dest: /usr/local/bin/{{ emacsconf_id }}-lowres-{{ item.id }}-on-disconnect
    mode: 0755
  loop: "{{ emacsconf_tracks }}"
- name: Set up init file
  become: true
  template:
    src: icecast-emacsconf.init.d
    dest: /etc/init.d/emacsconf
    mode: 0755
- name: Set up nginx config
  become: true
  template:
    src: emacsconf.nginx.conf
    dest: /etc/nginx/emacsconf.nginx.conf
    mode: 0644
- name: Enable icecast
  become: true
  service:
    name: emacsconf
    state: started
    enabled: yes
- name: Check if icecast is listening
  wait_for:
    port: "{{ icecast_port }}"
    delay: 5
    timeout: 20
    msg: "Timeout waiting for {{ icecast_port }} to respond"
  register: port_check
  ignore_errors: yes
- name: Try to restart icecast if not started
  service: name=emacsconf state=started enabled=yes
  when: port_check.failed == true
# - name: Set up restream script
#   template:
#     src: restream-yt.sh
#     dest: /home/orga/restream-yt.sh
#     owner: orga
#     mode: 0755