Ansible repo for digital ocean projects
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

mpdf.yaml 3.2 KiB

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