Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backup foreman #1909

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions puppet/data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ profiles::backup::receiver::targets:
- controller01
- discourse01
- puppet01
- foreman01

profiles::backup::sender::host: '%{alias("backup_servicename")}'
profiles::backup::sender::ssh_key: 'AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNfA651gsxAgFzWdBjFbTTXgZ+mIovdHE2TZShmyDJ9h6On+qQ3WOGVXflyrocM93vR4diZT80bnyIpLZtIf5RY='
Expand Down
28 changes: 28 additions & 0 deletions puppet/modules/profiles/manifests/foreman.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,32 @@
puppet::config::main { 'dns_alt_names':
value => $foreman::serveraliases,
}

package {'rubygem-foreman_maintain':
ensure => present,
}

$backup_base_path = '/var/backups'
$backup_path = "${backup_base_path}/foreman"

file { $backup_base_path:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
file { $backup_path:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0750',
}

include profiles::backup::sender

restic::repository { 'foreman':
backup_cap_dac_read_search => true,
backup_path => $backup_path,
backup_pre_cmd => ["+/usr/bin/foreman-maintain backup online --assumeyes --preserve-directory ${backup_path}"],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know systemd could do this, but nice!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither did I until a few days ago :)

}
}
7 changes: 7 additions & 0 deletions puppet/spec/classes/profiles_foreman_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
let(:pre_condition) do
<<~PUPPET
class { 'restic':
password => 'SuperSecret',
}
PUPPET
end

it { is_expected.to compile.with_all_deps }
end
Expand Down