add new roles
This commit is contained in:
37
playbooks/roles/backup/tasks/main.yml
Normal file
37
playbooks/roles/backup/tasks/main.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# tasks to make the host a backup-node
|
||||
|
||||
- name: Create directory for backup utilities
|
||||
ansible.builtin.file:
|
||||
path: /home/alarm/backup/dump/machine/home
|
||||
state: directory
|
||||
owner: alarm
|
||||
group: alarm
|
||||
mode: '0744'
|
||||
|
||||
- name: Create empty log file
|
||||
ansible.builtin.file:
|
||||
path: /home/alarm/backup/backup.log
|
||||
state: touch
|
||||
mode: '0644'
|
||||
|
||||
- name: Set modification date to 1 week ago
|
||||
ansible.builtin.command:
|
||||
cmd: touch -d "1 week ago" /home/alarm/backup/backup.log
|
||||
|
||||
- name: Copy backup script
|
||||
ansible.builtin.copy:
|
||||
src: backup_script.sh
|
||||
dest: /home/alarm/backup/backup_script.sh
|
||||
owner: alarm
|
||||
group: alarm
|
||||
mode: '0755'
|
||||
|
||||
- name: Add cronjob for daily backups
|
||||
ansible.builtin.cron:
|
||||
name: "daily backup"
|
||||
user: alarm
|
||||
minute: "33"
|
||||
hour: "3"
|
||||
job: "/home/alarm/backup/backup_script.sh > /home/alarm/backup/backup.log 2>&1"
|
||||
Reference in New Issue
Block a user