summaryrefslogblamecommitdiffstats
path: root/roles/stream/tasks/main.yml
blob: 941ac9248b276bea7a954dc48526168a503ae1d8 (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                             




                                      

                                    
                                











                                         








                                                          

                      
          
                   
                  
                



                                     
               





                                                            







                                                                      
- 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: Set up track-specific things
  include: track.yml
  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: Include emacsconf in nginx config
  tags: wip
  become: true
  lineinfile:
    line: include /etc/nginx/emacsconf.nginx.conf;
    regexp: '^\s*include /etc/nginx/emacsconf.nginx.conf;'
    insertafter: '.*tls/live0.conf.*'
    backup: yes
    path: /etc/nginx/sites-available/live0.emacsconf.org
- 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 scripts
  tags: restream
  template:
    src: restream.sh
    dest: /home/orga/restream-{{ item[1].name }}-{{ item[0].name }}.sh
    owner: orga
    mode: 0755
  loop: "{{ restreaming_platforms | subelements('streams') | list }}"