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

Add support for jumphosts #128

Merged
merged 1 commit into from
Oct 14, 2021
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
8 changes: 8 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,11 @@ Configure the name of each backupjob and the time of that job.

Default value: `{ 'default' => '18:30:00' }`

##### <a name="ssh_proxyjump"></a>`ssh_proxyjump`

Data type: `Optional[String[1]]`

Configure possible bastionhosts for the connection.

Default value: ``undef``

36 changes: 26 additions & 10 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,32 @@
}

# /root/.ssh/config entry for the backup server
ssh::client::config::user { 'root':
ensure => present,
user_home_dir => '/root',
options => {
'Host backup' => {
'User' => $borg::username,
'IdentityFile' => "~/.ssh/id_${borg::ssh_key_type}_borg",
'Hostname' => $borg::backupserver,
'Port' => $borg::ssh_port,
if $borg::ssh_proxyjump {
ssh::client::config::user { 'root':
ensure => present,
user_home_dir => '/root',
options => {
'Host backup' => {
'User' => $borg::username,
'IdentityFile' => "~/.ssh/id_${borg::ssh_key_type}_borg",
'Hostname' => $borg::backupserver,
'Port' => $borg::ssh_port,
'ProxyJump' => $borg::ssh_proxyjump,
},
},
},
}
} else {
ssh::client::config::user { 'root':
ensure => present,
user_home_dir => '/root',
options => {
'Host backup' => {
'User' => $borg::username,
'IdentityFile' => "~/.ssh/id_${borg::ssh_key_type}_borg",
'Hostname' => $borg::backupserver,
'Port' => $borg::ssh_port,
},
},
}
}
}
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
# @param backuptime
# Configure the name of each backupjob and the time of that job.
#
# @param ssh_proxyjump
# Configure possible bastionhosts for the connection.
#
# @see https://metacpan.org/pod/App::BorgRestore
#
class borg (
Expand Down Expand Up @@ -131,6 +134,7 @@
Boolean $manage_package = true,
Enum['rsa', 'ed25519'] $ssh_key_type = 'ed25519',
Hash[String[1],String[1]] $backuptime = { 'default' => '18:30:00' },
Optional[String[1]] $ssh_proxyjump = undef,
) {
contain borg::install
contain borg::config
Expand Down