[Add backup gitea ok]
This commit is contained in:
42
backup-gitea.yml
Normal file
42
backup-gitea.yml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
- hosts: tower
|
||||||
|
vars:
|
||||||
|
dockerapps_path: /opt/dockerapps
|
||||||
|
# become: true
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
|
||||||
|
#/opt/dockerapps/appdata/gitea/gitea/gitea-dump-*.zip
|
||||||
|
# - name: DUMP gitea conf
|
||||||
|
# community.docker.docker_container_exec:
|
||||||
|
# container: gitea
|
||||||
|
# command: gitea dump -c /data/gitea/conf/app.ini
|
||||||
|
# user: git
|
||||||
|
# chdir: /data
|
||||||
|
# register: result_gitea_conf
|
||||||
|
|
||||||
|
# - name: Print stdout
|
||||||
|
# ansible.builtin.debug:
|
||||||
|
# var: result_gitea_conf.stdout
|
||||||
|
|
||||||
|
|
||||||
|
#! need root
|
||||||
|
# root@scaleway:/opt/dockerapps/appdata/gitea/gitea-db/gitea-db-pg.sql
|
||||||
|
|
||||||
|
- name: PG_DUMP postgresql db
|
||||||
|
community.docker.docker_container_exec:
|
||||||
|
container: gitea-db
|
||||||
|
command: pg_dump -U root gitea -f /var/lib/postgresql/data/gitea-db-pg.sql
|
||||||
|
# chdir: "{{ dockerapps_path }}"
|
||||||
|
register: result_gitea_db
|
||||||
|
|
||||||
|
- name: Print stdout
|
||||||
|
ansible.builtin.debug:
|
||||||
|
var: result_gitea_db.stdout
|
||||||
|
|
||||||
|
|
||||||
|
# docker exec -u git -w /data/ gitea gitea dump -c /data/gitea/conf/app.ini
|
||||||
|
# mv /opt/dockerapps/appdata/gitea/gitea/gitea-dump-*.zip /opt/dockerapps/backup/
|
||||||
|
# docker exec gitea-db pg_dump -U root gitea > gitea-db-pg.sql
|
||||||
|
# mv ./gitea-db-pg.sql /opt/dockerapps/backup/
|
||||||
|
# find /opt/dockerapps/backup/ -mtime +7 -exec rm {} \;
|
||||||
Reference in New Issue
Block a user