Ansible repo for digital ocean projects
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

mpdf.yaml 3.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. - hosts: all
  2. gather_facts: true
  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: default
  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. backendhost: "{{ {{ inventory_hostname }}|replace("f", "b") }}"
  40. tasks:
  41. - name: Install mpdf on hosts
  42. apt:
  43. name: mpd
  44. state: present
  45. - name: setup config on hosts
  46. template:
  47. src: mpdf.conf.j2
  48. dest: "/etc/mpdf{{ item }}.conf"
  49. mode: 0644
  50. owner: root
  51. group: root
  52. loop: "{{ range(1,count|int + 1) }}"
  53. - name: mpdf var directory
  54. file:
  55. path: "/var/lib/mpd{{ item }}"
  56. state: directory
  57. owner: root
  58. group: root
  59. mode: '0777'
  60. loop: "{{ range(1,count|int + 1) }}"
  61. - name: mpdf playlist directory
  62. file:
  63. path: "/var/lib/mpd{{ item }}/playlist"
  64. state: directory
  65. owner: root
  66. group: root
  67. mode: '0755'
  68. loop: "{{ range(1,count|int + 1) }}"
  69. # - name: mpdf pid file
  70. # file:
  71. # path: "/var/lib/mpd{{ item }}/pid"
  72. # state: touch
  73. # owner: root
  74. # group: root
  75. # mode: '0755'
  76. #loop: "{{ range(1,count|int + 1) }}"
  77. - name: mpdf music directory
  78. file:
  79. path: "/var/lib/mpd{{ item }}/music"
  80. state: directory
  81. owner: root
  82. group: root
  83. mode: '0755'
  84. loop: "{{ range(1,count|int + 1) }}"
  85. - name: copy sticker.sql
  86. copy:
  87. src: "/var/lib/mpd/sticker.sql"
  88. dest: "/var/lib/mpd{{ item }}/sticker.sql"
  89. owner: root
  90. group: root
  91. mode: '0644'
  92. loop: "{{ range(1,count|int + 1) }}"
  93. - name: setup service on hosts
  94. template:
  95. src: mpdf.service.j2
  96. dest: "/usr/lib/systemd/system/mpdf{{ item }}.service"
  97. mode: 0644
  98. owner: root
  99. group: root
  100. loop: "{{ range(1,count|int + 1) }}"
  101. - name: mpd service start
  102. systemd:
  103. name: "mpdf{{ item }}"
  104. state: started
  105. enabled: yes
  106. masked: no
  107. daemon_reload: yes
  108. loop: "{{ range(1,count|int + 1) }}"