|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- - hosts: mpdf
- gather_facts: true
- vars:
- mpdcount: 5
- path: /var/lib/mpd
- playlist_directory: /playlist/
- db_file: tag_cache
- log_dir: /var/log/
- log_file: mpd.log
- pid_file: pid
- state_file: state
- sticker_file: sticker
- user: mpd
- group: nogroup
- bind_to_address: any
- bind_address: any
- mpdport: 6600
- log_level: default
- gapless_mp3_playback: yes
- save_absolute_paths_in_playlists: yes
- metadata_to_use: artist,album,title,track,name,genre,date,composer,performer,disc
- auto_update: no
- auto_update_depth: 3
- follow_outside_symlinks: no
- follow_inside_symlinks: no
- zeroconf_enabled: no
- zeroconf_name: mpd
- default_permissions: read,add,control,admin
- stream: music
- stream_port: 6700
- stream_bind_address: any
- mixer_type: disabled
- replaygain: album
- replaygain_preamp: 0
- volume_normalization: no
- audio_buffer_size: 2048
- buffer_before_play: "1%"
-
- tasks:
- - name: Gather information about a specific droplet by name
- community.digitalocean.digital_ocean_droplet_info:
- oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
- name: mpdb1
- register: droplets
- - name: Print return information from the previous task
- ansible.builtin.debug:
- var: "{{ droplets }}"
- verbosity: 2
- - name: Install mpdf on hosts
- apt:
- name: mpd
- state: present
- - name: setup config on hosts
- template:
- src: mpdf.conf.j2
- dest: "/etc/mpdf{{ item }}.conf"
- mode: 0644
- owner: root
- group: root
- loop: "{{ range(1,mpdcount|int + 1) }}"
- - name: mpdf var directory
- file:
- path: "/var/lib/mpd{{ item }}"
- state: directory
- owner: root
- group: root
- mode: '0777'
- loop: "{{ range(1,mpdcount|int + 1) }}"
- - name: mpdf playlist directory
- file:
- path: "/var/lib/mpd{{ item }}/playlist"
- state: directory
- owner: root
- group: root
- mode: '0755'
- loop: "{{ range(1,mpdcount|int + 1) }}"
- # - name: mpdf pid file
- # file:
- # path: "/var/lib/mpd{{ item }}/pid"
- # state: touch
- # owner: root
- # group: root
- # mode: '0755'
- #loop: "{{ range(1,count|int + 1) }}"
- - name: mpdf music directory
- file:
- path: "/var/lib/mpd{{ item }}/music"
- state: directory
- owner: root
- group: root
- mode: '0755'
- loop: "{{ range(1,mpdcount|int + 1) }}"
- - name: copy sticker.sql
- copy:
- src: "/var/lib/mpd/sticker.sql"
- dest: "/var/lib/mpd{{ item }}/sticker.sql"
- owner: root
- group: root
- mode: '0644'
- loop: "{{ range(1,mpdcount|int + 1) }}"
- - name: setup service on hosts
- template:
- src: mpdf.service.j2
- dest: "/usr/lib/systemd/system/mpdf{{ item }}.service"
- mode: 0644
- owner: root
- group: root
- loop: "{{ range(1,mpdcount|int + 1) }}"
- - name: mpd service start
- systemd:
- name: "mpdf{{ item }}"
- state: started
- enabled: yes
- masked: no
- daemon_reload: yes
- loop: "{{ range(1,mpdcount|int + 1) }}"
-
-
|