gitea: can now backup the database remotely

This commit is contained in:
CPunch 2023-02-01 23:30:14 -06:00
parent bf198f9d63
commit feaea47028
6 changed files with 37 additions and 10 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
hosts hosts
backups

View File

@ -1,3 +1,4 @@
--- ---
domain: openpunk.com
contact_email: openpunk@proton.me contact_email: openpunk@proton.me
onionDomain: http://opnpnk6eutjiqy4ndpyvwxd5pncj2g2cmz6fkocr5uh3omnn4utvspad.onion onionDomain: http://opnpnk6eutjiqy4ndpyvwxd5pncj2g2cmz6fkocr5uh3omnn4utvspad.onion

View File

@ -18,10 +18,6 @@
- zsh # :D - zsh # :D
- python3-certbot-nginx - python3-certbot-nginx
- name: Grab package facts
package_facts:
manager: auto
- name: Setup zsh - name: Setup zsh
user: user:
name: "{{ ansible_user }}" name: "{{ ansible_user }}"

View File

@ -0,0 +1,25 @@
---
- name: Stop Gitea
systemd:
name: gitea
enabled: yes
state: stopped
- name: Dump Gitea
shell:
cmd: gitea dump -c /etc/gitea/app.ini --work-path=/etc/gitea --file=gitea-dump.zip
chdir: /etc/gitea
become: true
become_method: su
become_user: gitea
- name: Start Gitea
systemd:
name: gitea
enabled: yes
state: started
- name: Fetch backup
fetch:
src: /etc/gitea/gitea-dump.zip
dest: backups

View File

@ -4,6 +4,10 @@
path: /etc/apt/trusted.gpg.d/morph027-gitea.gpg path: /etc/apt/trusted.gpg.d/morph027-gitea.gpg
register: gitea_key register: gitea_key
- name: Grab package facts
package_facts:
manager: auto
- name: Install Gitea - name: Install Gitea
block: block:
- name: Add Gitea key, repository && install - name: Add Gitea key, repository && install
@ -34,6 +38,10 @@
name: gitea name: gitea
enabled: yes enabled: yes
state: started state: started
- name: Backup db
include_tasks: backup.yml
tags: ['never', 'backup']
when: giteaUninstall == false when: giteaUninstall == false
- name: Uninstall Gitea - name: Uninstall Gitea

View File

@ -8,11 +8,6 @@
vars_files: vars_files:
- group_vars/all.yml - group_vars/all.yml
vars_prompt:
- name: domain
prompt: domain pointing to the vps
private: no
roles: roles:
- role: essential - role: essential
- role: firewall - role: firewall
@ -20,6 +15,7 @@
- role: deadswitch - role: deadswitch
- role: blog - role: blog
- role: gitea - role: gitea
tags: [backup]
- role: nginx - role: nginx
- role: goaccess - role: goaccess
- role: tor - role: tor