diff --git a/all.yml b/all.yml index b7c8da0..345c7d2 100644 --- a/all.yml +++ b/all.yml @@ -3,28 +3,49 @@ become: yes roles: - role: base - tags: ["base"] + tags: + - base - role: cron - tags: ["cron"] + tags: + - cron - role: ufw - tags: ["ufw"] + tags: + - ufw - role: fail2ban - tags: ["fail2ban"] - - role: "node-exporter" - tags: ["node-exporter"] - - role: "docker" - tags: ["docker"] - - role: "traefik" - tags: ["docker", "traefik"] - - role: "grav" - tags: ["docker", "grav"] - - role: "lychee" - tags: ["docker", "lychee"] - - role: "web" - tags: ["docker", "web"] - - role: "gitea" - tags: ["docker", "gitea"] - - role: "nextcloud" - tags: ["nextcloud", "docker"] - - role: "funkwhale" - tags: ["funkwhale", "docker"] + tags: + - fail2ban + - role: node-exporter + tags: + - node-exporter + - role: docker + tags: + - docker + - role: traefik + tags: + - docker + - traefik + - role: grav + tags: + - docker + - grav + - role: lychee + tags: + - docker + - lychee + - role: web + tags: + - docker + - web + - role: gitea + tags: + - docker + - gitea + - role: nextcloud + tags: + - nextcloud + - docker + - role: music + tags: + - funwkhale + - music + - docker diff --git a/inv/host_vars/chosto.me/secrets.yml b/inv/host_vars/chosto.me/secrets.yml index bef4171..1ac8953 100644 --- a/inv/host_vars/chosto.me/secrets.yml +++ b/inv/host_vars/chosto.me/secrets.yml @@ -1,34 +1,50 @@ $ANSIBLE_VAULT;1.1;AES256 -34363462333030653462383364323934653331333861333732303365626439666666393232376139 -6161356563623135646365323133326333383734383136340a643335623334363066353930303638 -38653862376330353361613661383330343338633963333538623934396537356137643833663262 -3431653035643063330a383634633966643133386236303064663666303935333636386532363363 -33646631343761363133646635663836313832616264313134616635373230393935396330373936 -36656666623631636230356665366532613230396565336136316530633432326665366135376238 -34633666623063383632663333366137666265363663323264643631323463633865336635636435 -35616631623532303536613064353135353034333739656432393835303839333165633135663934 -31663233656137653230343036666336386361393937383636336536396539303131393133653234 -30343030373863636232643635656664643561383264643465363163656131323731326361623639 -31663362363337306238616564336330303462346537393336363266323031653166323366333466 -36376433373663666535623864303533353837663064623432306363356638363634323831663437 -31663462323666633835663831653439306438376662343762663136613532366136636661383166 -33303563613436323334366532316336346635356433663766363831646336336665653365616663 -32303165313935326462393833363563313235386637353761306262353733316265383133303037 -35373338653931383463323533646262653066323164313939336336376262353066363339653938 -62383035653333663663336364646634336563366131653665373033333365386562333966353063 -36383964633561326262616439383739343736343362363264393137366662306630656364333532 -63346331636266626637666264343263303534313038386263666634353330643938393236336361 -34356661343334316162313030636533643064383531653836356366623432383066333033663536 -32656639323030653635636265343731336531646539356261383139663261386439376237396536 -62666130353038386635333265376630376165376433336436636331316531663935663339356436 -35303765303031323564333232363335643235376366613931653035313035663737353937393737 -66353663643735623762303234663762356136326133656338656664313637346136376266383636 -36386637326430626264666362643639636533373530366337373561643335363236646237636338 -62393531643663646433303233366233366536373865613331383539616238303135383665343930 -33303930633533333637343634393038356235646533613766623436306666306166383632303233 -38343063636236663432333336393838373637633737363865373261343965623736326433313937 -34323037326362323032356232373065666639616362393536653663316439376662636431626238 -32353838666535633831353538306634636562343633656663343131386462656536633663333235 -38386435313336613962313665616132323431356333353861386663313562373837663966623532 -65363438643666326163393761626231386331343435636562336363643733353439326230326637 -61633531316335396662663539366264633034373333336638323734336364323038 +35376236373035613335313435383265653332323962633762363266636261656131643436306366 +3339373933333834663766333037376235366130393061310a313363636539363432386432626166 +65343366356137363139643634636562303763616463396533633734323032323335343964333161 +3561663166616261380a663438316537636363383230323264666462333736656663663534346366 +33646131636334346438396661623566626234346365653863643537656662396263373638336331 +64643266616331323533383937653335646565346363666538333039646434623732333265353633 +37346536643536396638643836393363323465303135313065356136333239313537386638656163 +62343430316437666432623439303131383936616436633038383234323830396261353933363736 +33616265653539653335633965353262633162393131323861653265303831633765323635313464 +35376532376332333637343532313133303164353834613065333432656332336463333135633435 +39623631623732336165663133326130346138313535636430646134316137646666656231316537 +61363439333231323666396132353339386234383437623131613333346431353861343437383931 +62366236663934356632626535656231623833386263643463383334383536383531306262343166 +38316566316161306662373138353430356232383166653133323735363663343934383236623631 +61366463663831373030373165323764623738613936306233303138653666323339643066636264 +66653432663662646631333732383734666465303137346532343137643433616565393033613061 +37633930333065663062386266373761643966333432623638383565643365653964313536333433 +61613637386232353039643538613735363837386337636138633466643232303563346235376639 +66663161383032373962303739623164643531326236343532353063376662666331366435333261 +30333431626234373036333537333035613431366632613438623235396463363434643432336337 +63633533386532323739303633343466376664643763343637336338346364633662633031396264 +39636464333932303962393634313338643738646138333230343765616439313830323738333235 +64393832353665333961373134363431356163316163366161346633666264373334346263366366 +39353863353965303762633136343362383337383664626134313833346536306138623962336464 +38306363663335323030653262643839303930613461313862383633373838353337336437383537 +30316463313064633438303434616464336366633135363566646434396636653732333562336533 +35346134376163323135333139623331373238613665396635636232366161383634323530393339 +36393966626136633330363834313936353937363338623463663034376561353436353466363561 +37616465376665643965656361623464653834346461373132643333323736396662346261353464 +61383737646665373537653434643836316634363435363839373632636335363166656338626564 +61326136366139353232663565333563656166393239383737343430666563636462323766633030 +36366531666535633833343036363437396461376237306161356162616633336233636236303434 +62613837303430333963366534613733613234636334356563623562633532323763383539386236 +33393637383762356566316436363665303062343537366631613832343466363762333538343763 +31393762363831363539373538633064626161313830333734633335636133373564623730363734 +37663037363765363766376365336539613961366466326465623736356462643134393764636330 +61336562626432613266366563343032303965613437356463313866613330643963633736656537 +34393834363439373766393133623537316165643839653534343030396238393331613634646331 +37626635346330633033336237346466613065383133393961636632393138323063383638666166 +34316131643838333132623338313061643765646163366334646535303263366163386663343536 +34313661393432313730303233323230343031633338366264383837656464336630313662613037 +37383563353864363361376232626137376339633964333164313038396462303961666163626663 +61363863393566653237303539626339396239626564636466653964306231326632386338376536 +35383063313539363336386434346365343965313134323334386232636436336365386334303363 +33623130383161663965353633336166366633643830316332393761393034333033376531636665 +64356532396239336237353466363536313862643435353761386633316533346630663731373764 +66616261333935336232383030393962363032636362636565313561626233363363656539376364 +30376263393136643039626663336236373333343133313433366132346165646564316466643430 +37383165643334626433623461653862643666323461326361356663373039396465 diff --git a/inv/host_vars/chosto.me/vars.yml b/inv/host_vars/chosto.me/vars.yml index b3ec301..d8529b7 100644 --- a/inv/host_vars/chosto.me/vars.yml +++ b/inv/host_vars/chosto.me/vars.yml @@ -10,6 +10,7 @@ ssh_port: "2220" prometheus_server_ip: "51.178.182.35" docker_files: "/home/{{ base_user_name }}/docker" + compose_version: "3.7" traefik_network: proxy diff --git a/music.yml b/music.yml new file mode 100644 index 0000000..6a5f2a3 --- /dev/null +++ b/music.yml @@ -0,0 +1,28 @@ +--- +- hosts: all + become: yes + tasks: + - name: Download and configure deezloader and beets + include_role: + name: music + tasks_from: download_music_requirements + tags: + - requirements + - name: Install and configure Funkwhale + include_role: + name: music + tasks_from: funkwhale + tags: + - install + - name: Download submitted list of albums + include_role: + name: music + tasks_from: download_music + tags: + - download + - name: Import music into Funkwhale + include_role: + name: music + tasks_from: import_music + tags: + - import diff --git a/roles/music/files/albums.txt b/roles/music/files/albums.txt new file mode 100644 index 0000000..76207b7 --- /dev/null +++ b/roles/music/files/albums.txt @@ -0,0 +1 @@ +https://www.deezer.com/fr/album/42024091 diff --git a/roles/funkwhale/files/funkwhale_proxy.conf b/roles/music/files/funkwhale_proxy.conf similarity index 100% rename from roles/funkwhale/files/funkwhale_proxy.conf rename to roles/music/files/funkwhale_proxy.conf diff --git a/roles/music/tasks/download_music.yml b/roles/music/tasks/download_music.yml new file mode 100644 index 0000000..3df277f --- /dev/null +++ b/roles/music/tasks/download_music.yml @@ -0,0 +1,10 @@ +- name: Download required albums + shell: + argv: "deez-dw.py --recursive_download True --recursive_quality True --output {{ deezloader_songs_path }} --not_gui False --link {{ item }}" + chdir: "{{ deezloader_folder_path }}" + with_lines: "cat files/albums.txt" + register: output_deezloader + +- name: Show download state + debug: + msg: "{{ output_deezloader }}" diff --git a/roles/music/tasks/download_music_requirements.yml b/roles/music/tasks/download_music_requirements.yml new file mode 100644 index 0000000..0302ad5 --- /dev/null +++ b/roles/music/tasks/download_music_requirements.yml @@ -0,0 +1,33 @@ +- name: Install deezloader and beets + pip: + name: "{{ item }}" + state: present + loop: + - deezloader + - beets + +- name: Create deezloader and beets directories + file: + path: "{{ item }}" + state: directory + owner: "{{ base_user_name }}" + group: "{{ base_user_name }}" + mode: 0755 + recurse: yes + loop: + - "{{ deezloader_folder_path }}" + - "{{ deezloader_songs_path }}" + - "{{ beets_config_folder }}" + +- name: Update deezloader configuration file + template: + src: deezloader_settings.ini.j2 + dest: "{{ deezloader_folder_path }}/settings.ini" + owner: "{{ base_user_name }}" + group: "{{ base_user_name }}" + mode: 0644 + +- name: Update beets configuration file + template: + src: beets_config.yaml.j2 + dest: "{{ beets_config_folder }}/config.yaml" diff --git a/roles/funkwhale/tasks/main.yml b/roles/music/tasks/funkwhale.yml similarity index 100% rename from roles/funkwhale/tasks/main.yml rename to roles/music/tasks/funkwhale.yml diff --git a/roles/music/tasks/import_music.yml b/roles/music/tasks/import_music.yml new file mode 100644 index 0000000..e69de29 diff --git a/roles/music/templates/beets_config.yaml.j2 b/roles/music/templates/beets_config.yaml.j2 new file mode 100644 index 0000000..e3191fc --- /dev/null +++ b/roles/music/templates/beets_config.yaml.j2 @@ -0,0 +1,28 @@ +directory: {{ funkwhale_import_music_directory_host }} +threaded: yes +plugins: lyrics ftintitle embedart duplicates fetchart lastgenre acousticbrainz lyrics + +match: + # Allow 90% confidence for auto-tagging + strong_rec_thresh: 0.10 + max_rec: + media: strong + label: strong + year: strong + preferred: + # I have only a few physical CD + media: ['Digital Media'] + +discogs: + user_token: {{ discogs_user_token }} + +acoustid: + apikey: {{ acoustid_api_key }} + +ui: + color: yes + +import: + write: yes + move: yes + log: /var/log/beets.log diff --git a/roles/funkwhale/templates/conf.env.j2 b/roles/music/templates/conf.env.j2 similarity index 100% rename from roles/funkwhale/templates/conf.env.j2 rename to roles/music/templates/conf.env.j2 diff --git a/roles/music/templates/deezloader_settings.ini.j2 b/roles/music/templates/deezloader_settings.ini.j2 new file mode 100644 index 0000000..8fcd6e1 --- /dev/null +++ b/roles/music/templates/deezloader_settings.ini.j2 @@ -0,0 +1,2 @@ +[login] +token = {{ arl_deezer_token }} diff --git a/roles/funkwhale/templates/docker-compose.yml.j2 b/roles/music/templates/docker-compose.yml.j2 similarity index 100% rename from roles/funkwhale/templates/docker-compose.yml.j2 rename to roles/music/templates/docker-compose.yml.j2 diff --git a/roles/funkwhale/templates/nginx.conf.j2 b/roles/music/templates/nginx.conf.j2 similarity index 100% rename from roles/funkwhale/templates/nginx.conf.j2 rename to roles/music/templates/nginx.conf.j2 diff --git a/roles/funkwhale/vars/main.yml b/roles/music/vars/main.yml similarity index 68% rename from roles/funkwhale/vars/main.yml rename to roles/music/vars/main.yml index 9b94955..fcfa3b6 100644 --- a/roles/funkwhale/vars/main.yml +++ b/roles/music/vars/main.yml @@ -10,3 +10,6 @@ funkwhale_subdomain: music nginx_max_body_size: 100M postgres_version: 13 redis_version: 6 +deezloader_folder_path: /home/{{ base_user_name }}/deezloader +deezloader_songs_path: "{{ deezloader_folder_path }}/songs" +beets_config_folder: "/home/{{ base_user_name }}/.config/beets"