---
  - name: Install IceCast2 (14.04)
    become: true
    apt: deb=http://downloadcontent.opensuse.org/repositories/multimedia:/xiph/xUbuntu_14.04/amd64/icecast2_2.4.2-2_amd64.deb
    when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'

  - name: Install IceCast2 (16.04)
    become: true
    apt: pkg=icecast2 state=latest
    when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial'

  - name: Install LiquidSoap
    become: true
    apt: pkg="{{ item }}" install_recommends=yes state=latest
    with_items:
     - liquidsoap
     - liquidsoap-plugin-all

  - name: Link Fallback Error MP3
    file: src="{{ www_base }}/resources/error.mp3" dest="/usr/share/icecast2/web/error.mp3" state=link
---
  - name: Install IceCast2 (14.04)
    become: true
    apt: deb=http://downloadcontent.opensuse.org/repositories/multimedia:/xiph/xUbuntu_14.04/amd64/icecast2_2.4.2-2_amd64.deb
    when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'trusty'

  - name: Install IceCast2 (16.04)
    become: true
    apt: pkg=icecast2 state=latest
    when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial'

  - name: Remove problematic LiquidSoap plugins
    become: true
    apt: pkg="{{ item }}" state=absent
    with_items:
     - liquidsoap-plugin-all
     - liquidsoap-plugin-opus

  - name: Install LiquidSoap
    become: true
    apt: pkg="{{ item }}" install_recommends=yes state=latest
    with_items:
     - liquidsoap
     - liquidsoap-plugin-ogg
     - liquidsoap-plugin-vorbis
     - liquidsoap-plugin-lame
     - liquidsoap-plugin-flac
     - liquidsoap-plugin-icecast

  - name: Link Fallback Error MP3
    file: src="{{ www_base }}/resources/error.mp3" dest="/usr/share/icecast2/web/error.mp3" state=link
Update LiquidSoap deployed configuration to remove Opus support because, for reasons that aren't entirely clear, LiquidSoap can't decode Ogg Vorbis files if it's enabled.
Update LiquidSoap deployed configuration to remove Opus support because, for reasons that aren't entirely clear, LiquidSoap can't decode Ogg Vorbis files if it's enabled.
