homeserver/roles/mgrote_youtubedl/tasks/main.yml
Michael Grote 6157fa5d48 youtubedl: remove podcast download (#636)
Reviewed-on: #636
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Co-committed-by: Michael Grote <michael.grote@posteo.de>
2023-12-22 12:26:15 +01:00

115 lines
2.5 KiB
YAML

---
- name: download binary
become: true
ansible.builtin.get_url:
url: "{{ ytdl_dl_url }}"
dest: /usr/local/bin/yt-dlp
mode: "0750"
- name: install packages
become: true
ansible.builtin.package:
name:
- ffmpeg
- brotli
- python3-mutagen
state: present
- name: ensure dir exists
become: true
ansible.builtin.file:
path: "{{ ytdl_conf_dir }}"
state: directory
owner: root
group: root
mode: "0755"
- name: template youtubedl video config
become: true
ansible.builtin.template:
src: youtube.txt
dest: "{{ ytdl_conf_dir }}/youtube.txt"
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
when: ytdl_enable_video_download
- name: template youtubedl podcast config
become: true
ansible.builtin.template:
src: podcast.txt
dest: "{{ ytdl_conf_dir }}/podcast.txt"
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
when: ytdl_enable_podcast_download
- name: template systemd services
become: true
ansible.builtin.template:
src: "youtubedl.service.j2"
dest: "/etc/systemd/system/youtubedl.service"
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
when: ytdl_active
- name: template youtubedl timer
become: true
ansible.builtin.template:
src: "youtubedl.timer.j2"
dest: "/etc/systemd/system/youtubedl.timer"
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
when: ytdl_active
- name: template youtube_mail.service.j2
become: true
ansible.builtin.template:
src: "youtubedl_mail.service.j2"
dest: "/etc/systemd/system/youtubedl_mail.service"
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
when: ytdl_active
- name: systemctl enable timer units
become: true
ansible.builtin.systemd:
name: "youtubedl.timer"
enabled: true
masked: false
state: started
notify:
- systemctl daemon-reload
when: ytdl_active
- name: ensure youtubedl video config is absent
become: true
ansible.builtin.file:
state: absent
path: "{{ ytdl_conf_dir }}/youtube.txt"
notify:
- systemctl daemon-reload
when: not ytdl_enable_video_download
- name: ensure youtubedl podcast config is absent
become: true
ansible.builtin.file:
state: absent
path: "{{ ytdl_conf_dir }}/podcast.txt"
notify:
- systemctl daemon-reload
when: not ytdl_enable_podcast_download
...