- name: Check if peertube deployment is present ansible.builtin.stat: path: "{{ item }}" loop: - "{{ peertube_install_dir }}/compose.yaml" - "{{ peertube_install_dir }}/env" register: peertube_files - name: "docker compose down" community.docker.docker_compose_v2: state: "absent" project_src: "{{ peertube_install_dir }}" when: peertube_files.results | map(attribute='stat.exists') | select('equalto', false) | list | length == 0 - name: "Create the peertube directory" file: path: "{{ peertube_install_dir }}" state: "directory" - name: Create docker-compose.yml file for Peertube template: src: docker-compose.yml.j2 dest: "{{ peertube_install_dir }}/docker-compose.yml" - name: Create .env file for Peertube template: src: "env.j2" dest: "{{ peertube_install_dir }}/env" - name: "docker compose up -d peertube" community.docker.docker_compose_v2: state: "present" pull: policy project_src: "{{ peertube_install_dir }}" - ansible.builtin.lineinfile: path: "/backup-dirs" line: "{{ peertube_install_dir }}" - ansible.builtin.lineinfile: path: "/backup-dirs" line: "/mnt/juice/peertube"