make backup bettr
This commit is contained in:
parent
e41e2b83d5
commit
fffe7adbfd
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: "Deploy basic webhost with Docker"
|
||||
hosts: keycloak, drone, swagger, guacamole, bitwarden, nexus, nextcloud, git,
|
||||
hosts: keycloak, drone, swagger, guacamole, bitwarden, nexus, nextcloud
|
||||
roles:
|
||||
- netplan
|
||||
- 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"
|
@ -6,4 +6,4 @@ Type=simple
|
||||
ExecStart=/usr/bin/bash /opt/backupscript.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=backup.target
|
||||
WantedBy=backup.target
|
||||
|
@ -2,4 +2,4 @@
|
||||
Description=Script based backup for VMs
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
WantedBy=default.target
|
||||
|
@ -7,4 +7,4 @@ OnCalendar=Sun *-*-* 00:00:00
|
||||
Unit=backup.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
|
@ -1 +0,0 @@
|
||||
echo "true"
|
@ -1,31 +1,35 @@
|
||||
---
|
||||
- name: Copy backupscript to target
|
||||
copy:
|
||||
src: "{{ backupscript_name }}"
|
||||
- name: "Generate backupscript"
|
||||
ansible.builtin.template:
|
||||
src: backupscript.sh
|
||||
dest: /opt/backupscript.sh
|
||||
mode: 700
|
||||
owner: service-user
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0700'
|
||||
|
||||
- name: Copy backup-script.service to target
|
||||
copy:
|
||||
src: backup-script.service
|
||||
dest: /usr/lib/systemd/system/backup-script.service
|
||||
mode: 644
|
||||
owner: service-user
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: Copy backup.target to target
|
||||
copy:
|
||||
src: backup.target
|
||||
dest: /usr/lib/systemd/system/backup.target
|
||||
mode: 644
|
||||
owner: service-user
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: Copy backup.timer to target
|
||||
copy:
|
||||
src: backup.timer
|
||||
dest: /usr/lib/systemd/system/backup.timer
|
||||
mode: 644
|
||||
owner: service-user
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: Enable backup-script.service and reload systemd daemon
|
||||
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