Ansible repo for digital ocean projects
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

119 rader
3.2 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: "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. loop: "{{ range(1,mpdcount|int + 1) }}"
  60. - name: mpdf var directory
  61. file:
  62. path: "/var/lib/mpd{{ item }}"
  63. state: directory
  64. owner: root
  65. group: root
  66. mode: '0777'
  67. loop: "{{ range(1,mpdcount|int + 1) }}"
  68. - name: mpdf playlist directory
  69. file:
  70. path: "/var/lib/mpd{{ item }}/playlist"
  71. state: directory
  72. owner: root
  73. group: root
  74. mode: '0755'
  75. loop: "{{ range(1,mpdcount|int + 1) }}"
  76. # - name: mpdf pid file
  77. # file:
  78. # path: "/var/lib/mpd{{ item }}/pid"
  79. # state: touch
  80. # owner: root
  81. # group: root
  82. # mode: '0755'
  83. #loop: "{{ range(1,count|int + 1) }}"
  84. - name: mpdf music directory
  85. file:
  86. path: "/var/lib/mpd{{ item }}/music"
  87. state: directory
  88. owner: root
  89. group: root
  90. mode: '0755'
  91. loop: "{{ range(1,mpdcount|int + 1) }}"
  92. - name: copy sticker.sql
  93. copy:
  94. src: "/var/lib/mpd/sticker.sql"
  95. dest: "/var/lib/mpd{{ item }}/sticker.sql"
  96. owner: root
  97. group: root
  98. mode: '0644'
  99. loop: "{{ range(1,mpdcount|int + 1) }}"
  100. - name: setup service on hosts
  101. template:
  102. src: mpdf.service.j2
  103. dest: "/usr/lib/systemd/system/mpdf{{ item }}.service"
  104. mode: 0644
  105. owner: root
  106. group: root
  107. loop: "{{ range(1,mpdcount|int + 1) }}"
  108. - name: mpd service start
  109. systemd:
  110. name: "mpdf{{ item }}"
  111. state: started
  112. enabled: yes
  113. masked: no
  114. daemon_reload: yes
  115. loop: "{{ range(1,mpdcount|int + 1) }}"