make backup bettr
This commit is contained in:
parent
e41e2b83d5
commit
fffe7adbfd
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: "Deploy basic webhost with Docker"
|
- name: "Deploy basic webhost with Docker"
|
||||||
hosts: keycloak, drone, swagger, guacamole, bitwarden, nexus, nextcloud, git,
|
hosts: keycloak, drone, swagger, guacamole, bitwarden, nexus, nextcloud
|
||||||
roles:
|
roles:
|
||||||
- netplan
|
- netplan
|
||||||
- common
|
- common
|
||||||
|
11
gitea.yaml
Normal file
11
gitea.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
- name: "Deploy gitea in Docker"
|
||||||
|
hosts: git
|
||||||
|
roles:
|
||||||
|
- netplan
|
||||||
|
- common
|
||||||
|
- docker
|
||||||
|
- webserver
|
||||||
|
- internalsmtp
|
||||||
|
- backupscript
|
||||||
|
- gitea
|
5
host_vars/git.yaml
Normal file
5
host_vars/git.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
service-name: git
|
||||||
|
backup:
|
||||||
|
preare-command: ""
|
||||||
|
folder: "/home/git"
|
@ -1 +0,0 @@
|
|||||||
echo "true"
|
|
@ -1,31 +1,35 @@
|
|||||||
---
|
---
|
||||||
- name: Copy backupscript to target
|
- name: "Generate backupscript"
|
||||||
copy:
|
ansible.builtin.template:
|
||||||
src: "{{ backupscript_name }}"
|
src: backupscript.sh
|
||||||
dest: /opt/backupscript.sh
|
dest: /opt/backupscript.sh
|
||||||
mode: 700
|
owner: root
|
||||||
owner: service-user
|
group: root
|
||||||
|
mode: '0700'
|
||||||
|
|
||||||
- name: Copy backup-script.service to target
|
- name: Copy backup-script.service to target
|
||||||
copy:
|
copy:
|
||||||
src: backup-script.service
|
src: backup-script.service
|
||||||
dest: /usr/lib/systemd/system/backup-script.service
|
dest: /usr/lib/systemd/system/backup-script.service
|
||||||
mode: 644
|
mode: 644
|
||||||
owner: service-user
|
owner: root
|
||||||
|
group: root
|
||||||
|
|
||||||
- name: Copy backup.target to target
|
- name: Copy backup.target to target
|
||||||
copy:
|
copy:
|
||||||
src: backup.target
|
src: backup.target
|
||||||
dest: /usr/lib/systemd/system/backup.target
|
dest: /usr/lib/systemd/system/backup.target
|
||||||
mode: 644
|
mode: 644
|
||||||
owner: service-user
|
owner: root
|
||||||
|
group: root
|
||||||
|
|
||||||
- name: Copy backup.timer to target
|
- name: Copy backup.timer to target
|
||||||
copy:
|
copy:
|
||||||
src: backup.timer
|
src: backup.timer
|
||||||
dest: /usr/lib/systemd/system/backup.timer
|
dest: /usr/lib/systemd/system/backup.timer
|
||||||
mode: 644
|
mode: 644
|
||||||
owner: service-user
|
owner: root
|
||||||
|
group: root
|
||||||
|
|
||||||
- name: Enable backup-script.service and reload systemd daemon
|
- name: Enable backup-script.service and reload systemd daemon
|
||||||
when: ansible_service_mgr == "systemd"
|
when: ansible_service_mgr == "systemd"
|
||||||
|
8
roles/backupscript/templates/backupscript.sh
Normal file
8
roles/backupscript/templates/backupscript.sh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# {{ansible_managed}}
|
||||||
|
|
||||||
|
{{backup.preare-command}}
|
||||||
|
|
||||||
|
time ( rsync -azP --delete {{backup.folder}} backup@192.168.69.26:/mnt/backupstore/{{service-name}}/staging )
|
||||||
|
|
||||||
|
time ( ssh backup@backup.stargate.internal 'tar -zcvf /mnt/backupstore/{{service-name}}/{{service-name}}-$(date +"%Y-%m-%d").tar.gz -C /mnt/backupstore/{{service-name}}/staging' )
|
6
roles/gitea/tasks/main.yaml
Normal file
6
roles/gitea/tasks/main.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- name: Allow git ssh via ufw
|
||||||
|
community.general.ufw:
|
||||||
|
rule: allow
|
||||||
|
port: 2222
|
||||||
|
proto: tcp
|
Loading…
Reference in New Issue
Block a user