Ansible repo for digital ocean projects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.1 KiB

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