Skip to content

Instantly share code, notes, and snippets.

@xholicka
Created March 26, 2023 18:55
Show Gist options
  • Save xholicka/8f548ff1a88e54816449999b79006ea2 to your computer and use it in GitHub Desktop.
Save xholicka/8f548ff1a88e54816449999b79006ea2 to your computer and use it in GitHub Desktop.
Ansible playbook to backup home directory
---
- name: Backup home directory
hosts: localhost
vars:
date: "{{ lookup('pipe', 'date +%Y%m%d-%H%M') }}"
tasks:
- name: Create archive of home directory
community.general.archive:
path: /home/pi/
dest: "/mnt/nas/Backups/pi3backups/home{{ date }}.tar.gz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment