:date: 2018-04-26 21:35 .. index:: kodi, ansible, raspberry pi, puppet, xbian, libreelec, linux .. .. seealso:: :ref:`` .. _2018-kodi_and_ansible: Kodi and ansible ================ I run a couple of `Kodi `__ instances on Raspberry Pi's. With more than one single instance I got the problem, that their configuration differs. You've got settings and add-ons that have different versions and configurations. Occasionally something breaks. In my case reinstalling the Raspberry Pi is the quickes and easiest way. But it is still a tedious job and it needs at least one or two hours of fiddling around to get everything mostly right. For server systems I use configuration management and deployment systems like `Puppet `__ or `Ansible `__. For the Raspberry Pi using Ansible seems to be the right choice due to its agent-less architecture. This article sums up some of the experience gathered when implementing this. -------- Distribution ------------ Beyond the many distributions *Kodi* can be run is, I tried two of those: :program:`LibreElec` and :program:`XBIAN`. LibreElec """"""""" A very compact, but also restricted platform that claims to have exactly enough installed to run *Kodi*. For the basic usage this might be enough. But when trying to fiddle around with the settings on a command line, I quickly hit some limitations: Mounting an NFS share using either a :file:`service`-file or :file:`/etc/fstab` does not seem to survive a reboot of the Raspberry Pi. The settings are in place, but are failing to get executed. Using the graphical interface of *Kodi* sources (see below) can be configured. The whole charme of automation is however not to have to do it yourself. XBIAN """"" A more complex, but probably not as fail proof setup of *Kodi*. I have been on :program:`XBIAN` before, but then switched to :program:`LibreElec` to avoid complexity. As mentioned above, this did not work, since my requirements exceeded the abilities of the :program:`LibreElec` environment. -------- Ansible ------- Ansible - or the SSH on steroids - connects to the *Kodi* instance via SSH and runs all commands on the remote host. There are two main parts that I put in into the configuration and therefore I will not have to do them again next time I have to setup the system. Sources """"""" The file :file:`/home/xbian/.kodi/userdata/sources.xml` contains the configured sources on the :program:`kodi` instance. Initially I had mounted *NFS* network shares locally, put some entries in :file:`/etc/fstab` and configured the sources manually. This approach did not work with :program:`LibreElec`: Adding mounts to either as :program:`Systemd` or in :file:`/etc/fstab` had no effect and the nfs mount failed. Even it it could be added manually. .. code::