Ansible repo for digital ocean projects
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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: yes
  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: Install mpdb on hosts
  53. apt:
  54. name:
  55. - mpd
  56. - mpc
  57. - libflac8
  58. - lame
  59. state: latest
  60. update_cache: yes
  61. - name: setup config on hosts
  62. template:
  63. src: mpdf.conf.j2
  64. dest: "/etc/mpdf{{ item }}.conf"
  65. mode: 0644
  66. owner: root
  67. group: root
  68. notify:
  69. - Restart MPD
  70. loop: "{{ range(1,mpdcount|int + 1) }}"
  71. - name: mpdf var directory
  72. file:
  73. path: "/var/lib/mpd{{ item }}"
  74. state: directory
  75. owner: root
  76. group: root
  77. mode: '0777'
  78. notify:
  79. - Restart MPD
  80. loop: "{{ range(1,mpdcount|int + 1) }}"
  81. - name: mpdf playlist directory
  82. file:
  83. path: "/var/lib/mpd{{ item }}/playlists"
  84. state: directory
  85. owner: root
  86. group: root
  87. mode: '0755'
  88. notify:
  89. - Restart MPD
  90. loop: "{{ range(1,mpdcount|int + 1) }}"
  91. # - name: mpdf pid file
  92. # file:
  93. # path: "/var/lib/mpd{{ item }}/pid"
  94. # state: touch
  95. # owner: root
  96. # group: root
  97. # mode: '0755'
  98. #loop: "{{ range(1,count|int + 1) }}"
  99. - name: mpdf music directory
  100. file:
  101. path: "/var/lib/mpd{{ item }}/music"
  102. state: directory
  103. owner: root
  104. group: root
  105. mode: '0755'
  106. notify:
  107. - Restart MPD
  108. loop: "{{ range(1,mpdcount|int + 1) }}"
  109. - name: copy sticker.sql
  110. copy:
  111. src: "/var/lib/mpd/sticker.sql"
  112. dest: "/var/lib/mpd{{ item }}/sticker.sql"
  113. owner: root
  114. group: root
  115. mode: '0644'
  116. notify:
  117. - Restart MPD
  118. loop: "{{ range(1,mpdcount|int + 1) }}"
  119. - name: setup service on hosts
  120. template:
  121. src: mpdf.service.j2
  122. dest: "/usr/lib/systemd/system/mpdf{{ item }}.service"
  123. mode: 0644
  124. owner: root
  125. group: root
  126. loop: "{{ range(1,mpdcount|int + 1) }}"
  127. notify:
  128. - Restart MPD
  129. - name: mpd service start
  130. systemd:
  131. name: "mpdf{{ item }}"
  132. state: started
  133. enabled: yes
  134. masked: no
  135. daemon_reload: yes
  136. loop: "{{ range(1,mpdcount|int + 1) }}"
  137. handlers:
  138. - name: Restart MPD
  139. ansible.builtin.service:
  140. name: "mpdf{{ item }}"
  141. state: restarted
  142. loop: "{{ range(1,mpdcount|int + 1) }}"