kso512.ansible-install-mpd
ansible-install-mpd
This is an Ansible Role designed to install the Music Player Daemon application from its source code, rather than using a package manager. Some package managers might not offer all features, like MP3 support, so building from source can be beneficial.
Note: This role is outdated and has been replaced by a new role: kso512.mpd.
Warning: I do not recommend using the default configuration directly on the Internet because it does not require a password for access. To enhance security, please adjust a variable named ansible_install_mpd_conf_src
to point to a custom configuration file outside of this repository.
Tested On:
Requirements
If you have a firewall enabled on your server, you need to configure it to allow incoming connections on TCP ports 6600 and 8000. This role does not come with any music or playlists, so you will need to add those yourself. Check the Role Variables section to find where to include them.
Role Variables
The default values below should work right away and only need changes if they don’t fit your needs.
Name | Description | Default Value |
---|---|---|
ansible_install_mpd_apt_prereqs | List of APT packages to install | (See NOTE A below) |
ansible_install_mpd_audio_output | Settings for audio output | (See NOTE B below) |
ansible_install_mpd_bind_to_address | Address for the control interface, e.g., "any" or "localhost" | any |
ansible_install_mpd_conf | Path to the MPD configuration file | {{ ansible_install_mpd_home }}/mpd.conf |
ansible_install_mpd_conf_src | Path to the MPD configuration source file | mpd.conf.j2 |
ansible_install_mpd_db_file | Path to the MPD database file | {{ ansible_install_mpd_home }}/database |
ansible_install_mpd_executable | Path to the MPD executable file | /usr/local/bin/mpd |
ansible_install_mpd_filename | Name of the MPD archive | {{ ansible_install_mpd_shortname }}.tar.gz |
ansible_install_mpd_gcc_version | Version of the Gnu C Compiler | 8 |
ansible_install_mpd_group | Group for the daemon process owner | mpd |
ansible_install_mpd_home | Main directory for the application | /home/mpd |
ansible_install_mpd_log_file | Path to the MPD log file | {{ ansible_install_mpd_home }}/log |
ansible_install_mpd_music_directory | Directory to store music | {{ ansible_install_mpd_home }}/music |
ansible_install_mpd_pid_file | Path to the MPD PID file | {{ ansible_install_mpd_home }}/pid |
ansible_install_mpd_playlist_directory | Directory to store playlists | {{ ansible_install_mpd_home }}/playlist |
ansible_install_mpd_port | Port for the control interface | 6600 |
ansible_install_mpd_shortname | Short name of the MPD archive | mpd-0.22.10 |
ansible_install_mpd_src | Directory to extract the source code | {{ ansible_install_mpd_src_base }}/{{ ansible_install_mpd_shortname }} |
ansible_install_mpd_src_base | Base directory for the source archive | {{ ansible_install_mpd_home }}/src |
ansible_install_mpd_state_file | Path to the MPD state file | {{ ansible_install_mpd_home }}/state |
ansible_install_mpd_sticker_file | Path to the MPD sticker file | {{ ansible_install_mpd_home }}/sticker.sql |
ansible_install_mpd_systemd_service_dest | Path to the MPD systemd service file | /lib/systemd/system/mpd.service |
ansible_install_mpd_systemd_service_src | Path to the MPD systemd service source file | systemd.mpd.service.j2 |
ansible_install_mpd_systemd_socket_dest | Path to the MPD systemd socket file | /lib/systemd/system/mpd.socket |
ansible_install_mpd_systemd_socket_src | Path to the MPD systemd socket source file | systemd.mpd.socket.j2 |
ansible_install_mpd_url_base | Base URL for downloading the source archive | http://www.musicpd.org/download/mpd/0.22 |
ansible_install_mpd_user | User that runs the daemon process | mpd |
NOTE A
Here’s a list of APT packages needed as prerequisites:
- cmake
- libadplug-dev
- libao-dev
- libasound2-dev
- libaudio-mpd-perl
- libaudiofile-dev
- libavahi-client-dev
- libavcodec-dev
- libavformat-dev
- libboost-dev
- libbz2-dev
- libcdio-paranoia-dev
- libchromaprint-dev
- libcppunit-dev
- libcurl4-gnutls-dev
- libexpat-dev
- libfaad-dev
- libflac-dev
- libfluidsynth-dev
- libgcrypt20-dev
- libgme-dev
- libgtest-dev
- libicu-dev
- libid3tag0-dev
- libiso9660-dev
- libjack-jackd2-dev
- libmad0-dev
- libmikmod-dev
- libmms-dev
- libmodplug-dev
- libmp3lame-dev
- libmpcdec-dev
- libmpdclient-dev
- libmpg123-dev
- libnfs-dev
- libogg-dev
- libopenal-dev
- libopus-dev
- libpcre3-dev
- libpulse-dev
- libresid-builder-dev
- libroar-dev
- libsamplerate0-dev
- libshine-dev
- libshout3-dev
- libsidplay2-dev
- libsidutils-dev
- libsmbclient
- libsmbclient-dev
- libsndfile1-dev
- libsndio-dev
- libsoxr-dev
- libsqlite3-dev
- libsystemd-dev
- libtwolame-dev
- libupnp-dev
- libvorbis-dev
- libwavpack-dev
- libwildmidi-dev
- libwrap0-dev
- libyajl-dev
- libzzip-dev
- ninja-build
- python3
- python3-pip
- unzip
- xmlto
NOTE B
For example, here is a setup for a HTTP stream in the ansible_install_mpd_audio_output
settings:
httpd:
type: httpd
name: My HTTP Stream
encoder: lame
port: 8000
bitrate: 128
format: "44100:16:2"
Dependencies
This role does not depend on any other roles.
Example Playbook
Here is a simple playbook to set up the MPD server for local access only, with a custom configuration file:
- hosts: servers
roles:
- { role: kso512.ansible-install-mpd, ansible_install_mpd_bind_to_address: 127.0.0.1, ansible_install_mpd_conf_src: local/mpd.conf.j2 }
License
This is released under the GNU General Public License version 2.
Author Information
Chris Lindbergh @kso512
Ansible role to install Music Player Daemon from source
ansible-galaxy install kso512.ansible-install-mpd