Move some tasks from gitea to gitea repos
This commit is contained in:
parent
05a29560af
commit
d4c2cc1e75
2 changed files with 35 additions and 32 deletions
|
@ -54,38 +54,8 @@
|
|||
- name: Include fail2ban tasks
|
||||
ansible.builtin.include_tasks: fail2ban.yml
|
||||
|
||||
- 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
|
||||
- name: Include repos tasks
|
||||
ansible.builtin.include_tasks: repos.yml
|
||||
|
||||
- name: Setup logrotate for gitea logs
|
||||
become: true
|
||||
|
|
33
roles/gitea/tasks/repos.yml
Normal file
33
roles/gitea/tasks/repos.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
- 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
|
Loading…
Reference in a new issue