class pantin::duplicity(
	Sensitive $encryption_key,
	Array[String] $patterns = [],
) {
	$hourmin = fqdn_rand(239)

	$verify_hour = 8 + $hourmin / 60
	$verify_min = $hourmin % 60

	$run_hour = $hourmin / 60
	$run_min = $hourmin % 60

	package { ['duplicity']:
		ensure => present,
		require => Package['rclone'],
	} ->
	file { '/usr/local/sbin/backup.sh':
		mode => '0755',
		content => file('pantin/usr/local/sbin/backup.sh'),
	} ->
	file { '/etc/duplicity.secrets':
		mode => '0600',
		content => Sensitive("PASSPHRASE=\"${encryption_key.unwrap}\"\n"),
	} ->
	file { '/etc/duplicity.conf':
		mode => '0644',
		content => template('pantin/etc/duplicity.conf.erb'),
	} ->
	file { '/etc/cron.d/duplicity':
		mode => '0644',
		content => template('pantin/etc/cron.d/duplicity.erb'),
	}
}
