update youtube-dl role #195
2 changed files with 29 additions and 37 deletions
|
@ -1,12 +1,12 @@
|
||||||
---
|
---
|
||||||
- name: download binary
|
- name: Ensure youtubedl(p) is present
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.get_url:
|
ansible.builtin.get_url:
|
||||||
url: "{{ ytdl_dl_url }}"
|
url: "{{ ytdl_dl_url }}"
|
||||||
dest: /usr/local/bin/yt-dlp
|
dest: /usr/local/bin/yt-dlp
|
||||||
mode: "0750"
|
mode: "0750"
|
||||||
|
|
||||||
- name: install packages
|
- name: Ensure dependencies are present
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name:
|
name:
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
- python3-mutagen
|
- python3-mutagen
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: ensure dir exists
|
- name: Ensure directories exist
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ ytdl_conf_dir }}"
|
path: "{{ ytdl_conf_dir }}"
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
group: root
|
group: root
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: template youtubedl video config
|
- name: Template youtubedl Video config
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: youtube.txt
|
src: youtube.txt
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
- systemctl daemon-reload
|
- systemctl daemon-reload
|
||||||
when: ytdl_enable_video_download
|
when: ytdl_enable_video_download
|
||||||
|
|
||||||
- name: template youtubedl podcast config
|
- name: Template youtubedl Podcast config
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: podcast.txt
|
src: podcast.txt
|
||||||
|
@ -48,46 +48,26 @@
|
||||||
- systemctl daemon-reload
|
- systemctl daemon-reload
|
||||||
when: ytdl_enable_podcast_download
|
when: ytdl_enable_podcast_download
|
||||||
|
|
||||||
- name: template systemd services
|
- name: Ensure services are present
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "youtubedl.service.j2"
|
src: "{{ item }}.j2"
|
||||||
dest: "/etc/systemd/system/youtubedl.service"
|
dest: "/etc/systemd/system/{{ item }}"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify:
|
notify:
|
||||||
- systemctl daemon-reload
|
- systemctl daemon-reload
|
||||||
|
loop:
|
||||||
|
- youtubedl.service
|
||||||
|
- youtubedl.timer
|
||||||
|
- youtubedl_mail.service
|
||||||
when: ytdl_active
|
when: ytdl_active
|
||||||
|
|
||||||
- name: template youtubedl timer
|
- name: Ensure timer unit is enabled
|
||||||
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
|
become: true
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: "youtubedl.timer"
|
name: youtubedl.timer
|
||||||
enabled: true
|
enabled: true
|
||||||
masked: false
|
masked: false
|
||||||
state: started
|
state: started
|
||||||
|
@ -95,7 +75,19 @@
|
||||||
- systemctl daemon-reload
|
- systemctl daemon-reload
|
||||||
when: ytdl_active
|
when: ytdl_active
|
||||||
|
|
||||||
- name: ensure youtubedl video config is absent
|
- name: Ensure service units are enabled
|
||||||
|
become: true
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: "{{ item }}"
|
||||||
|
masked: false
|
||||||
|
enabled: true
|
||||||
|
loop:
|
||||||
|
- youtubedl.service
|
||||||
|
- youtubedl.timer
|
||||||
|
- youtubedl_mail.service
|
||||||
|
when: ytdl_active
|
||||||
|
|
||||||
|
- name: Ensure youtubedl Video config is absent
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: absent
|
state: absent
|
||||||
|
@ -104,7 +96,7 @@
|
||||||
- systemctl daemon-reload
|
- systemctl daemon-reload
|
||||||
when: not ytdl_enable_video_download
|
when: not ytdl_enable_video_download
|
||||||
|
|
||||||
- name: ensure youtubedl podcast config is absent
|
- name: Ensure youtubedl Podcast config is absent
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: absent
|
state: absent
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{{ file_header | default () }}
|
{{ file_header | default () }}
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Save podcats and videos with youtubedl.
|
Description=Save podcast and videos with youtubedl.
|
||||||
OnFailure=youtubedl_mail.service
|
OnFailure=youtubedl_mail.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
|
Loading…
Reference in a new issue