---

 - name: Yggdrasil packages
   become: yes
   package:
     name: 
       - emby-server

 - name: Yggdrasil directories
   become: yes
   file: 
     path: "{{ item }}"
     state: directory
     owner: http
     group: http
     mode: 2750
   loop:
     - /srv/yggdrasil
     - /srv/yggdrasil/Digital_Library
     - /srv/yggdrasil/Music
     - /srv/yggdrasil/Videos
     - /srv/yggdrasil/Videos/Shows
     - /srv/yggdrasil/Videos/Movies
     - /srv/yggdrasil/Software

 - name: LiveTV channels
   command: /bin/bash -c "curl -s https://raw.githubusercontent.com/iptv-org/iptv/master/streams/us.m3u | egrep -A 1 {{ iptv_location }} 2>&1 | egrep -v '^--$'"
   register: livetv_channels

 - name: Write to file
   become: yes
   copy:
     content: "{{ livetv_channels.stdout }}"
     dest: /var/lib/emby/local-channels.m3u
     owner: emby
     group: http
     mode: 0640
