init commit borg
This commit is contained in:
1 parent
36ed650628
commit
4c6cc1e6da
14 files changed
+123
-296
No files matched your search
Executable → Regular
+35
-27
@@ -1,38 +1,46 @@
|
||||
---
|
||||
- name: generate backup ssh user
|
||||
user:
|
||||
name: "{{ backup_owner }}"
|
||||
- name: Setup backup storage password
|
||||
copy:
|
||||
content: "{{ backup_storage_key }}"
|
||||
dest: "{{ backup_home }}/.borg.key"
|
||||
owner: "{{ backup_owner }}"
|
||||
group: "{{ backup_group }}"
|
||||
comment: Backup user
|
||||
shell: /bin/sh
|
||||
mode: "0600"
|
||||
|
||||
- name: Setup User ssh_key
|
||||
authorized_key:
|
||||
user: "{{ backup_owner }}"
|
||||
key: "{{ backup_owner_ssh_key }}"
|
||||
- name: Setup ssh folder
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ backup_home }}/.ssh"
|
||||
owner: "{{ backup_owner }}"
|
||||
group: "{{ backup_group }}"
|
||||
mode: "0700"
|
||||
|
||||
- name: generate config lists
|
||||
template:
|
||||
src: backup/conf/{{ conf }}.list.j2
|
||||
dest: "{{ backup_conf }}/{{ conf }}.list"
|
||||
- name: Setup ssh keys
|
||||
copy:
|
||||
content: "{{ item.content }}"
|
||||
dest: "{{ backup_home }}/.ssh/{{ item.file }}"
|
||||
owner: "{{ backup_owner }}"
|
||||
group: "{{ backup_group }}"
|
||||
mode: "0600"
|
||||
loop:
|
||||
- filedir
|
||||
- db
|
||||
- mail
|
||||
- content: "{{ backup_owner_ssh_private_key }}"
|
||||
file: "id_rsa"
|
||||
- content: "{{ backup_owner_ssh_public_key }}"
|
||||
file: "id_rsa.pub"
|
||||
loop_control:
|
||||
loop_var: conf
|
||||
label: "{{ conf }}.list"
|
||||
label: "{{ item.file }}"
|
||||
|
||||
- name: setup backup script
|
||||
template:
|
||||
src: backup/backup_on_client.sh.j2
|
||||
dest: "{{ backup_folder }}/backup.sh"
|
||||
mode: 0740
|
||||
src: "./usr/local/bin/{{ backup_host }}-backup.sh.j2"
|
||||
dest: "/usr/local/bin/backup.sh"
|
||||
owner: "{{ backup_owner }}"
|
||||
group: "{{ backup_group }}"
|
||||
mode: "0750"
|
||||
|
||||
- name: setup cronjob for client backup generation
|
||||
- name: setup cron backup job
|
||||
cron:
|
||||
name: "backup"
|
||||
weekday: "{{ backup_times_weekday }}"
|
||||
hour: "{{ backup_times_hour | join(',') }}"
|
||||
minute: "{{ backup_times_minute }}"
|
||||
job: "{{ backup_folder }}/backup.sh"
|
||||
name: "{{ backup_host }} backup"
|
||||
user: "{{ backup_cron_owner }}"
|
||||
job: "/usr/local/bin/backup.sh"
|
||||
special_time: "{{ backup_cron_specialtime }}"
|
||||
Reference in new issue
Block a user