Skip to content

Commit

Permalink
Merge pull request #128 from sebastianberm/feature/bastionhost
Browse files Browse the repository at this point in the history
Add support for jumphosts
  • Loading branch information
bastelfreak authored Oct 14, 2021
2 parents e207393 + 95de609 commit 760f57d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
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

0 comments on commit 760f57d

Please sign in to comment.