Perform synchronization using rsync.
rsync
(will be installed)
-
rsync_sync_install_path
: [default:/usr/local/bin
]: Install directory -
rsync_sync_scripts
: [default:{}
]: Scripts declarations -
rsync_sync_scripts.key
: [required]: The name of the script (e.g.last-backup
) -
rsync_sync_scripts.key.pre
: [optional, default[]
]: Pre sync commands -
rsync_sync_scripts.key.rsync
: [required]: Rsync declarations -
rsync_sync_scripts.key.rsync.src
: [required]: The source directory -
rsync_sync_scripts.key.rsync.dest
: [required]: The destination directory -
rsync_sync_scripts.key.rsync.options
: [optional, default[]
]: Options (e.g.['--aP', '--delete']
) -
rsync_sync_scripts.key.rsync.time
: [optional, defaultfalse
]: Whether or not to time thersync
command -
rsync_sync_scripts.key.post
: [optional, default[]
]: Post sync commands -
rsync_sync_x_from_files
: [optional, default[]
]: -
rsync_sync_x_from_files.{n}.path
: [required]: The remote path of the file (relative to/etc/rsync-sync
) -
rsync_sync_x_from_files.{n}.owner
: [optional, defaultroot
]: The name of the user that should own the file -
rsync_sync_x_from_files.{n}.group
: [optional, defaultroot
]: The name of the group that should own the file -
rsync_sync_x_from_files.{n}.mode
: [optional, default0644
]: The UNIX permission mode bits of the file -
rsync_sync_x_from_files.{n}.content
: [optional, default[]
]: File content lines -
rsync_sync_jobs
: [default:[]
]: Sync jobs (scheduled bycron.d
) -
rsync_sync_jobs.{n}.name
: [required]: Description of a crontab entry, should be unique, and changing the value will result in a new cron task being created (e.g.last-backup
) -
rsync_sync_jobs.{n}.job
: [required]: The command to execute (e.g./usr/local/bin/last-backup
) -
rsync_sync_jobs.{n}.state
: [default:present
]: Whether to ensure the job is present or absent -
rsync_sync_jobs.{n}.day
: [default:*
]: Day of the month the job should run (1-31
,*
,*/2
) -
rsync_sync_jobs.{n}.hour
: [default:*
]: Hour when the job should run (e.g.0-23
,*
,*/2
) -
rsync_sync_jobs.{n}.minute
: [default:*
]: Minute when the job should run (e.g.0-59
,*
,*/2
) -
rsync_sync_jobs.{n}.month
: [default:*
]: Month of the year the job should run (e.g1-12
,*
,*/2
) -
rsync_sync_jobs.{n}.weekday
: [default:*
]: Day of the week that the job should run (e.g.0-6
for Sunday-Saturday,*
)
None
---
- hosts: all
roles:
- rsync-sync
vars:
rsync_sync_scripts:
last-backup:
pre:
- 'ssh -q -t example.com "test ! -f /var/lock/mydumper-backup"'
rsync:
src: '-e ssh example.com:/data/backup/mydumper/'
dest: '/data/backup/mydumper'
options:
- '-aP'
- '--delete'
post:
- mydumper-restore
rsync_sync_x_from_files:
- path: last-backup-include
content:
- |
+ *_app.*videos-schema.sql
+ *_app.*videos.sql
+ *_app_archive.*.sql
+ *_app_archive.*-schema.sql
+ metadata
- *
rsync_sync_jobs:
- name: last-backup
job: /usr/local/bin/last-backup
minute: 0
MIT
Mischa ter Smitten
Are welcome!