addd forgejo_dump_path var and adjust playbook
This commit is contained in:
parent
4abdfe530a
commit
43c5452dd6
2 changed files with 8 additions and 7 deletions
|
@ -4,17 +4,17 @@
|
|||
tasks:
|
||||
- name: '[BACKUP] - Create backup dir'
|
||||
file:
|
||||
path: '{{ forgejo_db_dump_path }}'
|
||||
path: '{{ forgejo_dump_path }}'
|
||||
state: directory
|
||||
mode: '0775'
|
||||
- name: '[BACKUP] - Create db backup dir'
|
||||
file:
|
||||
path: '{{ forgejo_db_dump_path }}/db'
|
||||
path: '{{ forgejo_dump_path }}/db'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
- name: '[BACKUP] - Create code backup dir'
|
||||
file:
|
||||
path: '{{ forgejo_db_dump_path }}/code'
|
||||
path: '{{ forgejo_dump_path }}/code'
|
||||
state: directory
|
||||
owner: '{{ forgejo_user }}'
|
||||
mode: '0755'
|
||||
|
@ -24,11 +24,11 @@
|
|||
tasks:
|
||||
- name: '[BACKUP] - Run db backup for forgejo'
|
||||
shell:
|
||||
cmd: 'sudo -u postgres pg_dump {{ forgejo_db_name }} | gzip -c > {{ forgejo_db_dump_path }}/{{ forgejo_db_name }}-{{ ansible_date_time.iso8601_basic_short }}.sql.gz'
|
||||
cmd: 'sudo -u postgres pg_dump {{ forgejo_db_name }} | gzip -c > {{ forgejo_dump_path }}/db/{{ forgejo_db_name }}-{{ ansible_date_time.iso8601_basic_short }}.sql.gz'
|
||||
- name: '[BACKUP] - Remove all but two latest backup files'
|
||||
shell:
|
||||
cmd: 'ls -t |tail -n +3 | xargs --no-run-if-empty rm'
|
||||
chdir: '{{ forgejo_db_dump_path }}'
|
||||
chdir: '{{ forgejo_dump_path }}/db'
|
||||
vars_files:
|
||||
- ../defaults/main.yml
|
||||
|
||||
|
@ -38,11 +38,11 @@
|
|||
- name: '[BACKUP] - Remove all but two latest backup files'
|
||||
shell:
|
||||
cmd: 'ls -t |tail -n +2 | xargs --no-run-if-empty rm'
|
||||
chdir: '/srv/forgejo_dump'
|
||||
chdir: '{{ forgejo_dump_path }}/code'
|
||||
- name: '[BACKUP] - Make backup of forgejo'
|
||||
shell:
|
||||
cmd: 'sudo -u {{ forgejo_user }} {{ forgejo_bindir }}/forgejo dump -c {{ forgejo_confdir }}'
|
||||
chdir: '/srv/forgejo_dump'
|
||||
chdir: '{{ forgejo_dump_path}}/code'
|
||||
vars_files:
|
||||
- ../defaults/main.yml
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ forgejo_lib_dir: "/var/lib/forgejo"
|
|||
forgejo_user: 'git'
|
||||
forgejo_group: 'git'
|
||||
forgejo_confdir: '/etc/forgejo/app.ini'
|
||||
forgejo_dump_path: '/srv/forgejo-dump'
|
||||
|
||||
forgejo_flavor: 'forgejo'
|
||||
forgejo_version: '7.0.3'
|
||||
|
|
Loading…
Reference in a new issue