33 lines
1.2 KiB
YAML
33 lines
1.2 KiB
YAML
---
|
|
- name: Set today's string for zipfile name
|
|
ansible.builtin.set_fact:
|
|
today: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}"
|
|
|
|
- name: Ask to push latest gitea_dump zipfile
|
|
ansible.builtin.pause:
|
|
prompt: "Local path to latest gitea dump, so we can push it [leave empty to not push]"
|
|
echo: true
|
|
register: latest_gitea_dump_path
|
|
|
|
- name: Make sure the filename makes sense
|
|
ansible.builtin.assert:
|
|
that:
|
|
- "{{ latest_gitea_dump_path.user_input | basename }} == gitea-dump-{{ today }}.zip"
|
|
when: latest_gitea_dump_path.user_input != ''
|
|
|
|
- name: Push latest gitea_dump zipfile
|
|
become: true
|
|
ansible.builtin.copy:
|
|
src: "{{ latest_gitea_dump_path.user_input }}"
|
|
dest: "/var/lib/gitea/gitea-dumps/gitea-dump-{{ today }}.zip"
|
|
owner: git
|
|
group: git
|
|
mode: 0640
|
|
when: latest_gitea_dump_path.user_input != ''
|
|
|
|
- name: Deploy repos
|
|
become: true
|
|
become_user: git
|
|
ansible.builtin.command:
|
|
cmd: "/var/lib/gitea/gitea_backup.sh restore /var/lib/gitea/gitea-dumps/gitea-dump-{{ today }}.zip"
|
|
creates: /var/lib/gitea/gitea-repositories # when this dir exists, the command won't run, so we don't overwrite existing repos
|