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.

114 lignes
3.0 KiB

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