34 lines
1.1 KiB
YAML
34 lines
1.1 KiB
YAML
---
|
|
- name: Ask to push latest gitea_dump zipfile
|
|
ansible.builtin.pause:
|
|
prompt: "Local path to gitea dump, so we can push it [leave empty to not push]"
|
|
echo: true
|
|
register: user_gitea_dump_path
|
|
|
|
- name: Push latest gitea dump zipfile
|
|
become: true
|
|
ansible.builtin.copy:
|
|
src: "{{ user_gitea_dump_path.user_input }}"
|
|
dest: "{{ gitea_run_dir }}/gitea-dumps/{{ user_gitea_dump_path.user_input | basename }}"
|
|
owner: git
|
|
group: git
|
|
mode: 0640
|
|
when: user_gitea_dump_path.user_input != ''
|
|
|
|
- name: Find all gitea dumps on the server
|
|
become: true
|
|
ansible.builtin.find:
|
|
paths: "{{ gitea_run_dir }}/gitea-dumps/"
|
|
register: all_gitea_dumps
|
|
|
|
- name: Find latest gitea dump on the server
|
|
ansible.builtin.set_fact:
|
|
latest_gitea_dump: "{{ all_gitea_dumps.files | sort(attribute='mtime') | last }}"
|
|
|
|
- name: Deploy repos from latest gitea dump
|
|
become: true
|
|
become_user: git
|
|
ansible.builtin.command:
|
|
cmd: "/usr/local/bin/gitea_backup.sh restore {{ latest_gitea_dump.path }}"
|
|
# when this dir exists, the command won't run, so we don't overwrite existing repos
|
|
creates: "{{ gitea_run_dir }}/gitea-repositories"
|