This ansible role configures autofs to mount a samba share and configure a script to run regular backups.
There are three required variables you need to set:
backup_smb_user
: the user that will access the backup cloudbackup_smb_password
: the password for this userbackup_script
: The shell commands to run for creating a backup
Have a look at the defaults to see all variables and how to set them.
Your playbook, could look like this:
- hosts: all
become: true
- role: uos.smb_backup
vars:
backup_smb_share: //smb.example.com/backup
backup_smb_user: samba_user
backup_smb_password: samba_user_password
backup_script: |
FILENAME="{{ backup_mountpoint }}/$(date '+%Y%m%d-%H%M%S').sql.gz"
mysqldump -u root dbname | gzip > "${FILENAME}"