Move single ansible playbook to ansible directory
Make ansible playbook properly- use ansible-galaxy init commands.
This commit is contained in:
64
ansible/arch_backup/tasks/main.yml
Normal file
64
ansible/arch_backup/tasks/main.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
# Backup
|
||||
- name: Create backup mount directory
|
||||
file:
|
||||
state: directory
|
||||
path: '/mnt/backup0'
|
||||
become: yes
|
||||
tags: backup
|
||||
- name: Ensure backup0 device exists in crypttab
|
||||
community.general.crypttab:
|
||||
name: backup0
|
||||
backing_device: UUID=1d7ce570-e695-47a0-9dda-5f14b5b20e21
|
||||
password: /home/ducoterra/.lukskeys/backup0
|
||||
opts: luks
|
||||
state: present
|
||||
become: yes
|
||||
no_log: true
|
||||
tags: backup
|
||||
- name: Ensure backup0 mount exists in fstab
|
||||
ansible.posix.mount:
|
||||
path: /mnt/backup0
|
||||
src: /dev/mapper/backup0
|
||||
fstype: btrfs
|
||||
opts: defaults,noatime,compress=zstd
|
||||
state: present
|
||||
become: yes
|
||||
tags: backup
|
||||
- name: Ensure /usr/local/scripts exists
|
||||
file:
|
||||
state: directory
|
||||
path: '/usr/local/scripts'
|
||||
become: yes
|
||||
tags: backup
|
||||
- name: Copy btrfs_backup.sh
|
||||
ansible.builtin.copy:
|
||||
src: scripts/btrfs_backup.sh
|
||||
dest: /usr/local/scripts/btrfs_backup.sh
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0760'
|
||||
become: yes
|
||||
tags: backup
|
||||
- name: Ensure hourly backups of /
|
||||
ansible.builtin.cron:
|
||||
name: "hourly backup of /"
|
||||
minute: "0"
|
||||
job: "export SOURCE_DIR=/; /usr/local/scripts/btrfs_backup.sh"
|
||||
become: yes
|
||||
tags: backup
|
||||
- name: Ensure hourly backups of /home
|
||||
ansible.builtin.cron:
|
||||
name: "hourly backup of /home"
|
||||
minute: "0"
|
||||
job: "export SOURCE_DIR=/home; /usr/local/scripts/btrfs_backup.sh"
|
||||
become: yes
|
||||
tags: backup
|
||||
- name: Ensure cronie service started
|
||||
ansible.builtin.systemd:
|
||||
name: cronie
|
||||
state: restarted
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
become: yes
|
||||
tags: backup
|
||||
Reference in New Issue
Block a user