propellor-2.1.0: property-based host configuration management in haskell

Safe HaskellNone
LanguageHaskell98

Propellor.Property.Obnam

Synopsis

Documentation

data NumClients Source

An obnam repository can be used by multiple clients. Obnam uses locking to allow only one client to write at a time. Since stale lock files can prevent backups from happening, it's more robust, if you know a repository has only one client, to force the lock before starting a backup. Using OnlyClient allows propellor to do so when running obnam.

Instances

backup :: FilePath -> Times -> [ObnamParam] -> NumClients -> Property NoInfo Source

Installs a cron job that causes a given directory to be backed up, by running obnam with some parameters.

If the directory does not exist, or exists but is completely empty, this Property will immediately restore it from an existing backup.

So, this property can be used to deploy a directory of content to a host, while also ensuring any changes made to it get backed up. And since Obnam encrypts, just make this property depend on a gpg key, and tell obnam to use the key, and your data will be backed up securely. For example:

	& Obnam.backup "/srv/git" "33 3 * * *"
		[ "--repository=sftp://2318@usw-s002.rsync.net/~/mygitrepos.obnam"
		] Obnam.OnlyClient
		`requires` Ssh.keyImported SshRsa "root" (Context hostname)

How awesome is that?

backupEncrypted :: FilePath -> Times -> [ObnamParam] -> NumClients -> GpgKeyId -> Property HasInfo Source

Like backup, but the specified gpg key id is used to encrypt the repository.

The gpg secret key will be automatically imported into root's keyring using Propellor.Property.Gpg.keyImported

backup' :: FilePath -> Times -> [ObnamParam] -> NumClients -> Property NoInfo Source

Does a backup, but does not automatically restore.

restored :: FilePath -> [ObnamParam] -> Property NoInfo Source

Restores a directory from an obnam backup.

Only does anything if the directory does not exist, or exists, but is completely empty.

The restore is performed atomically; restoring to a temp directory and then moving it to the directory.

latestVersion :: Property NoInfo Source

Ensures that a recent version of obnam gets installed.

Only does anything for Debian Stable.