finalyse mpd roles

This commit is contained in:
vincent 2019-01-08 22:03:29 +01:00
parent a5a49113f3
commit e9e11456fe
2 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,4 @@
--- ---
# defaults file for mpd # defaults file for mpd
music_directory: "/home/{{username}}/Music" music_directory: "/home/{{username}}/Music"
default_music_path: "/mnt/diskstation/music"

View File

@ -12,3 +12,16 @@
dest: /etc/mpd.conf # required. Location to render the template to on the remote machine. dest: /etc/mpd.conf # required. Location to render the template to on the remote machine.
src: ../templates/mpd.conf.j2 # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path. src: ../templates/mpd.conf.j2 # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path.
notify: start_mpd notify: start_mpd
- name: stat default music path
stat:
path: "{{default_music_path}}" # required. The full path of the file/object to get the facts of.
register: default_music_path_exist
- name: copy music
command: "rsync -avzu --progress -h {{default_music_path}} {{music_directory}}"
when: default_music_path_exist.stat.exists and music_directory is search("/home/")