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.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. - hosts: mpdf
  2. gather_facts: true
  3. vars:
  4. mpdcount: 5
  5. path: /var/lib/mpd
  6. playlist_directory: /playlists/
  7. db_file: tag_cache
  8. log_dir: /var/log/
  9. log_file: mpd.log
  10. pid_file: pid
  11. state_file: state
  12. sticker_file: sticker
  13. user: root
  14. group: nogroup
  15. bind_to_address: "0.0.0.0"
  16. bind_address: "0.0.0.0"
  17. mpdport: 6600
  18. log_level: default
  19. gapless_mp3_playback: yes
  20. save_absolute_paths_in_playlists: yes
  21. metadata_to_use: artist,album,title,track,name,genre,date,composer,performer,disc
  22. auto_update: no
  23. auto_update_depth: 3
  24. follow_outside_symlinks: no
  25. follow_inside_symlinks: no
  26. zeroconf_enabled: no
  27. zeroconf_name: mpd
  28. default_permissions: read,add,control,admin
  29. stream: music
  30. stream_port: 6700
  31. stream_bind_address: "0.0.0.0"
  32. mixer_type: disabled
  33. replaygain: album
  34. replaygain_preamp: 0
  35. volume_normalization: no
  36. audio_buffer_size: 2048
  37. buffer_before_play: "1%"
  38. tasks:
  39. - name: Gather information about a specific droplet by name
  40. community.digitalocean.digital_ocean_droplet_info:
  41. oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
  42. name: mpdb1
  43. register: droplets
  44. #- name: Print return information from the previous task
  45. # ansible.builtin.debug:
  46. # msg : "{{ droplets.data[0] }}"
  47. - name: Install mpdf on hosts
  48. apt:
  49. name: mpd
  50. state: latest
  51. update_cache: yes
  52. - name: setup config on hosts
  53. template:
  54. src: mpdf.conf.j2
  55. dest: "/etc/mpdf{{ item }}.conf"
  56. mode: 0644
  57. owner: root
  58. group: root
  59. notify:
  60. - Restart MPD
  61. loop: "{{ range(1,mpdcount|int + 1) }}"
  62. - name: mpdf var directory
  63. file:
  64. path: "/var/lib/mpd{{ item }}"
  65. state: directory
  66. owner: root
  67. group: root
  68. mode: '0777'
  69. notify:
  70. - Restart MPD
  71. loop: "{{ range(1,mpdcount|int + 1) }}"
  72. - name: mpdf playlist directory
  73. file:
  74. path: "/var/lib/mpd{{ item }}/playlists"
  75. state: directory
  76. owner: root
  77. group: root
  78. mode: '0755'
  79. notify:
  80. - Restart MPD
  81. loop: "{{ range(1,mpdcount|int + 1) }}"
  82. # - name: mpdf pid file
  83. # file:
  84. # path: "/var/lib/mpd{{ item }}/pid"
  85. # state: touch
  86. # owner: root
  87. # group: root
  88. # mode: '0755'
  89. #loop: "{{ range(1,count|int + 1) }}"
  90. - name: mpdf music directory
  91. file:
  92. path: "/var/lib/mpd{{ item }}/music"
  93. state: directory
  94. owner: root
  95. group: root
  96. mode: '0755'
  97. notify:
  98. - Restart MPD
  99. loop: "{{ range(1,mpdcount|int + 1) }}"
  100. - name: copy sticker.sql
  101. copy:
  102. src: "/var/lib/mpd/sticker.sql"
  103. dest: "/var/lib/mpd{{ item }}/sticker.sql"
  104. owner: root
  105. group: root
  106. mode: '0644'
  107. notify:
  108. - Restart MPD
  109. loop: "{{ range(1,mpdcount|int + 1) }}"
  110. - name: setup service on hosts
  111. template:
  112. src: mpdf.service.j2
  113. dest: "/usr/lib/systemd/system/mpdf{{ item }}.service"
  114. mode: 0644
  115. owner: root
  116. group: root
  117. loop: "{{ range(1,mpdcount|int + 1) }}"
  118. notify:
  119. - Restart MPD
  120. - name: mpd service start
  121. systemd:
  122. name: "mpdf{{ item }}"
  123. state: started
  124. enabled: yes
  125. masked: no
  126. daemon_reload: yes
  127. loop: "{{ range(1,mpdcount|int + 1) }}"
  128. handlers:
  129. - name: Restart MPD
  130. ansible.builtin.service:
  131. name: "mpdf{{ item }}"
  132. state: restarted
  133. loop: "{{ range(1,mpdcount|int + 1) }}"