Refactor MPD setup
This commit is contained in:
parent
d320ba7ee1
commit
abcd234b3d
10 changed files with 149 additions and 23 deletions
|
|
@ -1,14 +1,48 @@
|
|||
# remote mpd server is used now
|
||||
- name: copy systemd configuration files
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
loop:
|
||||
- {
|
||||
src: 'templates/mpd/service.j2',
|
||||
dest: '{{ xdg_config_dir }}/systemd/user/mpd.service',
|
||||
}
|
||||
- {
|
||||
src: 'templates/mpd/socket.j2',
|
||||
dest: '{{ xdg_config_dir }}/systemd/user/mpd.socket',
|
||||
}
|
||||
notify:
|
||||
- stop mpd service
|
||||
- restart mpd socket
|
||||
|
||||
- name: check for mpd socket
|
||||
stat:
|
||||
path: '{{ xdg_config_dir }}/systemd/user/mpd.socket'
|
||||
register: mpd_socket
|
||||
- name: create mpd files
|
||||
file:
|
||||
path: '{{ item.path }}'
|
||||
state: '{{ item.state }}'
|
||||
loop:
|
||||
- { path: '{{ mpd_configuration_dir }}', state: 'directory' }
|
||||
- { path: '{{ ncmpc_configuration_dir }}', state: 'directory' }
|
||||
- { path: '{{ mpd_configuration_dir }}/playlists', state: 'directory' }
|
||||
|
||||
- name: disable mpd socket
|
||||
systemd:
|
||||
name: mpd.socket
|
||||
state: stopped
|
||||
enabled: no
|
||||
scope: user
|
||||
when: mpd_socket.stat.exists
|
||||
- name: remove previous mpd files
|
||||
file:
|
||||
path: '{{ item.path }}'
|
||||
state: '{{ item.state }}'
|
||||
loop:
|
||||
- { path: '{{ mpd_configuration_dir }}/log', state: 'absent' }
|
||||
- { path: '{{ mpd_configuration_dir }}/database', state: 'absent' }
|
||||
- { path: '{{ mpd_configuration_dir }}/sticker.sql', state: 'absent' }
|
||||
|
||||
- name: copy configuration files
|
||||
template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
loop:
|
||||
- { src: 'templates/mpd/mpd.conf.j2', dest: '{{ mpd_configuration_dir }}/mpd.conf' }
|
||||
- { src: 'templates/mpd/ncmpc.j2', dest: '{{ ncmpc_configuration_dir }}/config' }
|
||||
notify:
|
||||
- stop mpd service
|
||||
# Use mpc to control local mpd server.
|
||||
# Use $ mpc add http://{{ mpd_remote_address }}:{{ mpd_remote_stream_port }}
|
||||
# to add the HTTP stream to the playlist.
|
||||
# Use nmcpc to control remote mpd server.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue