Git Product home page Git Product logo

htpc-ansible's Introduction

htpc-ansible

HTPC Server Automation with Kodi, Deluge (Bittorent), SABnzbd (Usenet), Couchpotato, Sickrage, HTPC-Manager, Tvheadend and nzbToMedia.

Overview

This project is designed to deploy and configure HTPC software on Ubuntu 14.04. It includes software roles, which can be set up on a single or multiple machines. All roles are customized with single configuration file, correctly deploying all the software.

All software packages are integrated together:

  • Download clients ( Deluge and Sabnzbd ) will be configured and integrated into Couchpotato and Sickrage placing downloaded files into Movies and TV Shows folders.
  • Kodi's will be configured with appropriate paths and new content will appear automatically in Kodi's Library.
  • Nzbtomedia will verify downloaded content and notify PVR software if to snatch another release in case the downloaded release is corrupted.
  • HTPC Manager will be configured with all relevant API Keys and credentials to present a single web interface for managing Deluge, Sabnzbd, Sickrage, Couchpotato, Tvheadend and Kodi.
  • Media folders and downloads will be shared with LAN clients ( Windows, Linux and Mac ) over CIFS, NFS and AFP.

Quick installation

There are two modes of installation:

  • Ubuntu 14.04 Desktop - machine is connected to TV/Monitor. Kodi GUI will start on boot.
  • Ubuntu 14.04 Server - Kodi will run in docker container.

In both modes media is shared over CIFS, NFS and AFP and Kodi uses MySQL.

Login to your Ubuntu 14.04 machine using gui or console. Run ONE of the below:

Desktop Mode:

wget --no-check-certificate https://raw.github.com/GR360RY/htpc-ansible/master/scripts/quickinstall.sh -O - | sh

Server Mode:

wget --no-check-certificate https://raw.github.com/GR360RY/htpc-ansible/master/scripts/quickinstall-headless.sh -O - | sh

Reboot your machine following the installation.

Downloads and Media folders layout if used with default variable values:

/mnt/media/             # Media path shared over NFS, CIFS and AFP
├── downloads               
│   ├── complete        # Complete Downloads for Deluge and Sabnzbd
│   └── Incomplete
│       ├── deluged     # Deluge Incomplete Downloads
│       ├── sabnzbd     # Sabnzbd Incomplete Downloads
│       └── process     # nzbtomedia processing folders
│           ├── movie
│           └── tv
├── movies              # Movies path for Kodi and Couchpotato
├── music               # Music library path in Kodi
├── pictures            # Pictures path in Kodi
└── tv                  # TV Shows path for Kodi and Sickrage

Default Credentials, Settings, Paths and URLs:

  • Name Resolution

    • Name resolution between services will be configured using ZeroConf/Bonjour.
    • HTPC will be resolvable with hostname.local. Assuming the hostname of the HTPC is htpc, HTPCManager will be accessible with http://htpc.local/. To enable ZeroConf/Bonjour on Windows, install Bonjour Print Services for Windows ( See customisation part to change this behaviour )
  • HTPC User

    • All services will be run under htpc user identified with htpc password
    • Sudo access for htpc user will be enabled
    • SSH service will be configured to start automatically on boot
  • Media, Downloads and Network Shares

    • All media and download folders will reside under /mnt/media
    • AFP and Samba read/write access will be available with htpc/htpc credentials
    • /mnt/media will be exported with NFS. NFS will "squash" all users to htpc uid
  • Kodi ( Desktop Mode Only )

    • htpc user will be logged in automatically to Ubuntu desktop on boot
    • Kodi will start in full screen as part of Ubuntu Desktop
  • Kodi ( Server and Desktop Modes )

    • Kodi Web Service will be enabled on port 8080 with user kodi and without a password
    • Kodi will be configured to use MySQL as a backend
    • Mysql user credentials for Kodi MySQL databases will be set to kodi/kodi
    • movies and tv folders will be configured with default scrappers in Kodi
    • Create hidden /mnt/media/.kodi_client_setup folder with advancedsettings.xml for configuring additional Kodi clients
  • Deluge

    • Deluge-Web Daemon will be configured to listen on port 8112
    • Deluge Daemon will be configured to listen on port 58846
    • Default Deluge Web password will be set to deluge
    • tv and movie labels will be configured.
    • nzbtomedia postprocessing scripts will be configured for each label
  • Sabnzbd

    • Sabnzbdplus will be configured to listen on port 9000
    • Usenet setup will remain to be completed through configuration wizard
    • movies and tv categories will be configured
    • nzbtomedia postprocessing scripts will be configured for each category
  • Sickrage

    • Will be configured to listen on port 8081
    • Deluge will be configured as download client
    • In "Search Providers", torrent trackers that do not require credentials will be configured
    • Sabnzbd will be configured as download client, but no Usenet "Search Providers" will be defined
    • Sickrage will sent "Rescan Library" command to Kodi on complete downloads
  • Couchpotato

    • Will be configured to listen on port 5050
    • Deluge will be configured as download client
    • In "Searcher", torrent trackers that do not require credentials will be configured
    • Sabnzbd will be configured as download client, but no Usenet "Searcher" will be defined
    • Couchpotato will sent "Rescan Library" command to Kodi on complete downloads
  • HtpcManager

    • Use Hellowlol HTPC-Manager Fork
    • Apache reverse proxy will be configured to serve HtpcManager on port 80
    • HtpcManager will be configured to listen on port 8085

Customizing the setup

Install Requirements

sudo apt-get install software-properties-common
sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get -y install ansible git

Clone the repository

git clone https://github.com/GR360RY/htpc-ansible.git --recursive
cd htpc-ansible

Edit Configuration

  • Create custom configuration file:
cd custom
cp custom.yml.sample custom.yml
  • Open custom.yml in your favorite editor and update variable values.
  • Run Ansible Playbook from your localhost:

Desktop Mode:

ansible-playbook -i inventory/server-withclient -c local -K htpc-server.yml

Server Mode:

ansible-playbook -i inventory/server-headless -c local -K htpc-server.yml

Development and Testing with Vagrant

If you want to test out the configuration in VirtualMachine or contribute to htpc-ansible development, install requirements and follow the below guide:

Requirements

Deployment

Both Server and Desktop modes can be tested in Vagrant. Vagrantfile presents multimachine environment were only Server VM will be started by default. To test Desktop mode, run vagrant up fullclient.

 ~/dev/htpc-ansible ⮀ ⭠ master± ⮀ vagrant status
Current machine states:

headless                  not created (virtualbox)
fullclient                not created (virtualbox)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.
  • Start the VM
# Server
vagrant up headless --no-provision

#Desktop
vagrant up fullclient --no-provision
  • Snapshot the machine.
vagrant snapshot save before_provisioning
  • Deploying htpc-ansible
vagrant provision
  • Reverting snapshot

In case you want to redeploy from scratch - simply revert the snapshot back to the machine with desktop installed.

vagrant snapshot restore before_provisioning

Testing and configuring WEB services

Vagrant boxes are configured to have bridged eth1 interface. All the web services can be tested and configured as following:

htpc-ansible's People

Contributors

gr360ry avatar map7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

htpc-ansible's Issues

Bug during installation

TASK: [sickbeard | Update sickbeard config.ini] ******************************* 
ok: [127.0.0.1]

TASK: [sickbeard | Make sure SickBeard starts on boot] ************************ 
failed: [127.0.0.1] => {"failed": true, "item": ""}
msg: Traceback (most recent call last):
  File "SickBeard.py", line 311, in <module>
    main()
  File "SickBeard.py", line 230, in main
    sickbeard.initialize(consoleLogging=consoleLogging)
  File "/opt/sickbeard/sickbeard/__init__.py", line 645, in initialize
    newznabProviderList = providers.getNewznabProviderList(newznabData)
  File "/opt/sickbeard/sickbeard/providers/__init__.py", line 58, in getNewznabProviderList
    providerList = filter(lambda x: x, [makeNewznabProvider(x) for x in data.split('!!!')])
  File "/opt/sickbeard/sickbeard/providers/__init__.py", line 88, in makeNewznabProvider
    name, url, key, enabled = configString.split('|')
ValueError: too many values to unpack


FATAL: all hosts have already failed -- aborting

XBMC Stability Issues

Disable UPnP and Screen Dimming and GUI Sounds to test if the problem is resolved

Add TvHeadEnd support

Please add automated installation of TvHeadEnd.

If possible, please also automatically configure locals muxes and automation for scanned channels.

better hostname support

Right now the script tries to set up the host name to htpc-server, but does not update it in /etc/hosts.
I suppose it would be better to just detect the actual hostname and use it.

configure Music and Photos libraries

htpc-ansible creates directories for Music and Photos under /mnt/xbmc, but XBMC is not configured to use them, so even if the user populates these directories, nothing is shown when the user enters the Photos/Music screen.

enable thepiratebay again

thepiratebay.org is back online (and even when it was offline, sickbeard changed its configuration to use oldpiratebay.org so it worked)

Sabnzbd fails to start

Error:

TASK: [sabnzbd | Make sure Sabnzbd is running and started on boot] ************
failed: [default] => {"failed": true, "item": ""}
msg: Traceback (most recent call last):
File "/usr/bin/sabnzbdplus", line 46, in
if not cherrypy.version.startswith("3.2"):
AttributeError: 'module' object has no attribute 'version'

sickbeard service installation is broken

Executed:
wget --no-check-certificate https://raw.github.com/GR360RY/htpc-ansible/master/scripts/htpc-server-torrents.sh -O - | sh

Results snippet:

TASK: [sickbeard | Install Requirements] **************************************
changed: [127.0.0.1] => (item=python-cheetah,git,python-setproctitle)

TASK: [sickbeard | Get SickBeard Code from GitHub] ****************************
failed: [127.0.0.1] => {"failed": true, "item": ""}
msg: Failed to checkout dev

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
to retry, use: --limit @/home/tali/htpc-server-torrents.retry

127.0.0.1 : ok=50 changed=40 unreachable=0 failed=1

prevent Ubuntu desktop lock

If XBMC is not running, the desktop may lock and require user password (when it happened to me, I couldn't input the password too so I had to reboot the computer :/). Please disable desktop locking.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.