Forge Home

rsync_cron

Periodically run rsync invoked by cron

7,983 downloads

7,829 latest version

2.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.1.1 (latest)
  • 0.1.0
released Nov 14th 2015

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'geoffwilliams-rsync_cron', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add geoffwilliams-rsync_cron
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install geoffwilliams-rsync_cron --version 0.1.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

geoffwilliams/rsync_cron — version 0.1.1 Nov 14th 2015

rsync_cron

Build Status

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with rsync_cron
  4. Usage - Configuration options and additional functionality
  5. Reference - An under-the-hood peek at what the module is doing and how
  6. Limitations - OS compatibility, etc.
  7. Development - Guide for contributing to the module

Overview

Manage a cron job to periodically rsync a directory between two computers. sync direction can be in any or both directions.

Rsync+ssh is used to avoid the need for a dedicated rsync service

Module Description

This module uses ssh and rsync to install a cron job to periodically sync directories between hosts. This is ideal for syncronising large directories of flies on a regular basis. Alternatively, this can also be used for machines such as laptops that are not always in reach of the systems they need to sync to.

A brief log file is also created for debugging purposes.

Setup

What rsync_cron affects

  • Manages a cron job to sync remote to local, local to remote or bi-directionally (by running both sync jobs sequentially) impact, or execute on the system it's installed on.
  • Doesn't handle deleted files (--delete)
  • Skips overwriting files that are newer (-u)
  • Only attempts to run rsync if the remote destination is online, as detected by the ping command

Setup Requirements

  • SSH keys need to exist on the Puppet Master already, this module just copies them, however, you could use the sshkeys module to generate them
  • SSH needs to be enabled on the host you are connecting to, on the standard port
  • cron and rsync packages must already be installed
  • machines you want to rsync between must be able to ping each other

Usage

Setting up the machine to receive the SSH connection

rsync_cron::host { "rsync@mylaptop.localdomain": }

Setup the node classified with this resource to accept a connection using the public key found on the Puppet Master in the /etc/sshkeys/rsync@mylaptop.localdomain.pub file

Setting up a machine to run the rsync command

rsync_cron::agent { "rsync@${::fqdn}":
  host => "ftp.localdomain",
}

Manage a cron job on the node classified with this resource. Targets a local user rsync. Files will be rsync'ed to/from ftp.localdomain

This example is geared around SSH keys generated with the sshkeys module. It is possible to override the this mechanism by specifying the key_file parameter. See source code for details.

Reference

  • rsync_cron - Dummy class to get rsync_cron::params class into scope
  • rsync_cron::params - Params pattern class
  • rsync_cron::host - Setup a host to receive connections via rsync+ssh
  • rsync_cron::agent - Setup a cron job to periodically rsync files to and or from another node that has had rsync_cron::host applied to it

Limitations

Tested on Ubuntu, will probably work elsewhere but untested.

Development

PRs accepted