infra/roles/mass/tasks/mass.yml

78 lines
2.0 KiB
YAML

---
- name: create dir structure
file:
path: "{{ item.path }}"
state: directory
mode: "{{ item.mode | default('0755') }}"
owner: "{{ item.owner | default(systemuserlist[mass_user].uid) }}"
group: "{{ item.group | default(systemuserlist[mass_user].gid) }}"
tags:
- hass-dirs
- mass-dirs
loop_control:
label: "{{ item.path }}"
with_items:
- path: "{{ mass_root }}/data"
- path: "{{ deadspace_root }}/audio"
mode: "0750"
group: "1301"
#- name: template config
# template:
# src: "{{ item }}.j2"
# dest: "{{ mass_root }}/data/{{ item }}"
# owner: "{{ systemuserlist[mass_user].uid }}"
# group: "{{ systemuserlist[mass_user].gid }}"
# mode: 0644
# with_items:
# - settings.json
# tags:
# - hass-config
# - mass-config
#
- name: music-assistant container {{ mass_container_state }}
docker_container:
name: music-assistant
image: ghcr.io/music-assistant/server
detach: true
pull: true
auto_remove: false
restart_policy: "unless-stopped"
state: "{{ mass_container_state }}"
container_default_behavior: compatibility
user: "{{ systemuserlist[mass_user].uid }}:{{ systemuserlist[mass_user].gid }}"
networks_cli_compatible: false
#capabilities:
# # for smb mount
# - SYS_ADMIN
# - DAC_READ_SEARCH
#privileged: true
network_mode: host
#network_mode: bridgewithdns
#networks:
# - name: bridgewithdns
# ipv4_address: "{{ bridgewithdns.mass }}"
#ports:
# - "127.0.0.1:{{ mass_port }}:{{ mass_port }}"
# - "8097:8097"
# - "8098:8098"
env:
TZ: "Europe/Berlin"
mounts:
- type: bind
source: "{{ mass_root }}/data"
target: /data
- type: bind
source: "{{ deadspace_root }}/audio"
target: "{{ deadspace_root }}/audio"
register: mass_container
when: mass_container_state != "stopped"
tags:
- mass-container
- music-assistant-container
- hass-mass-container
- hass-music-assistant-container
- hass-container
- docker-containers