I had to setup some new boxes with mopidy recently.
Using ansible (http://docs.ansible.com/ansible/latest/intro_getting_started.html) i got this to become a quite painless process.
Ansible gathers facts about the target system and decides what to do accordingly. This makes it more stable and adaptable then using shell scripts.
I put my code at https://github.com/rawdlite/mopidy-ansible
If you are interested let me know. I can provide more details then.