Ansible repo for digital ocean projects
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

103 rader
2.7 KiB

  1. - hosts: all
  2. gather_facts: false
  3. vars:
  4. #we need to loop over the /var/lib/mpd{{ count }} directory for the files/folders below. we need to loop over the stream ports as well
  5. count: 5
  6. path: /var/lib/mpd
  7. playlist_directory: /playlist/
  8. db_file: tag_cache
  9. log_dir: /var/log/
  10. log_file: mpd.log
  11. pid_file: pid
  12. state_file: state
  13. sticker_file: sticker
  14. user: mpd
  15. group: nogroup
  16. bind_to_address: any
  17. bind_address: any
  18. mpdport: 6600
  19. log_level:
  20. gapless_mp3_playback: yes
  21. save_absolute_paths_in_playlists: yes
  22. metadata_to_use: artist,album,title,track,name,genre,date,composer,performer,disc
  23. auto_update: no
  24. auto_update_depth: 3
  25. follow_outside_symlinks: no
  26. follow_inside_symlinks: no
  27. zeroconf_enabled: no
  28. zeroconf_name: mpd
  29. default_permissions: read,add,control,admin
  30. stream: music
  31. stream_port: 6700
  32. stream_bind_address: any
  33. mixer_type: disabled
  34. replaygain: album
  35. replaygain_preamp: 0
  36. volume_normalization: no
  37. audio_buffer_size: 2048
  38. buffer_before_play: "1%"
  39. tasks:
  40. - name: Install mpdf on hosts
  41. apt:
  42. name: mpd
  43. state: present
  44. - name: setup config on hosts
  45. template:
  46. src: mpdf.conf.j2
  47. dest: "/etc/mpdf{{ item }}.conf"
  48. mode: 0644
  49. owner: root
  50. group: root
  51. loop: "{{ range(1,count|int + 1) }}"
  52. - name: mpdf var directory
  53. file:
  54. path: "/var/lib/mpd{{ item }}"
  55. state: directory
  56. owner: root
  57. group: root
  58. mode: '0755'
  59. loop: "{{ range(1,count|int + 1) }}"
  60. - name: mpdf playlist directory
  61. file:
  62. path: "/var/lib/mpd{{ item }}/playlist"
  63. state: directory
  64. owner: root
  65. group: root
  66. mode: '0755'
  67. loop: "{{ range(1,count|int + 1) }}"
  68. - name: mpdf music directory
  69. file:
  70. path: "/var/lib/mpd{{ item }}/music"
  71. state: directory
  72. owner: root
  73. group: root
  74. mode: '0755'
  75. loop: "{{ range(1,count|int + 1) }}"
  76. - name: copy sticker.sql
  77. copy:
  78. src: "/var/lib/mpd/sticker.sql"
  79. dest: "var/lib/mpd{{ item }}/sticker.sql"
  80. owner: root
  81. group: root
  82. mode: '0644'
  83. loop: "{{ range(1,count|int + 1) }}"
  84. - name: setup service on hosts
  85. template:
  86. src: mpdf.service.j2
  87. dest: "/usr/lib/systemd/system/mpdf{{ item }}.service"
  88. mode: 0644
  89. owner: root
  90. group: root
  91. loop: "{{ range(1,count|int + 1) }}"
  92. - name: mpd service start
  93. systemd:
  94. name: "mpdf{{ item }}"
  95. state: started
  96. enabled: yes
  97. masked: no
  98. daemon_reload: yes
  99. loop: "{{ range(1,count|int + 1) }}"