--- - name: Ensure youtubedl(p) is present become: true ansible.builtin.get_url: url: "{{ ytdl_dl_url }}" dest: /usr/local/bin/yt-dlp mode: "0750" - name: Ensure dependencies are present become: true ansible.builtin.package: name: - ffmpeg - brotli - python3-mutagen state: present - name: Ensure directories exist 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: Ensure services are present become: true ansible.builtin.template: src: "{{ item }}.j2" dest: "/etc/systemd/system/{{ item }}" owner: root group: root mode: "0644" notify: - systemctl daemon-reload loop: - youtubedl.service - youtubedl.timer - youtubedl_mail.service when: ytdl_active - name: Ensure timer unit is enabled become: true ansible.builtin.systemd: name: youtubedl.timer enabled: true masked: false state: started notify: - systemctl daemon-reload when: ytdl_active - 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 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 ...