homeserver/roles/mgrote_youtubedl/tasks/main.yml
Michael Grote 7a24089031 fix linter errors (#584)
Reviewed-on: #584
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Co-committed-by: Michael Grote <michael.grote@posteo.de>
2023-10-25 22:26:17 +02:00

86 lines
1.7 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 config
become: true
ansible.builtin.template:
src: "{{ item }}"
dest: "{{ ytdl_conf_dir }}/{{ item }}"
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
loop:
- podcast.txt
- youtube.txt
- 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