Add puppet manifests and templates
This commit is contained in:
parent
82e0969f85
commit
2c69ca440a
21
manifests/init.pp
Normal file
21
manifests/init.pp
Normal file
@ -0,0 +1,21 @@
|
||||
# Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# == Class: autossh
|
||||
#
|
||||
class autossh () {
|
||||
package { 'autossh':
|
||||
ensure => 'present',
|
||||
}
|
||||
}
|
33
manifests/tunnel.pp
Normal file
33
manifests/tunnel.pp
Normal file
@ -0,0 +1,33 @@
|
||||
# Copyright 2015 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# == Define: autossh::tunnel
|
||||
#
|
||||
# A define to add an autossh tunnel
|
||||
define autossh::tunnel (
|
||||
$ensure = running,
|
||||
$ssh_port = '22',
|
||||
$ssh_host,
|
||||
$ssh_user,
|
||||
$ssh_key,
|
||||
$local_forward_args = undef,
|
||||
$remote_forward_args = undef,
|
||||
) {
|
||||
service { '/usr/lib/autossh':
|
||||
ensure => $ensure,
|
||||
start => template('autossh/autossh-command.erb'),
|
||||
stop => 'AUTOSSH_PID=`pidof autossh` && CHILD_PID=`pgrep -P $AUTOSSH_PID` && kill -9 $AUTOSSH_PID && kill -9 $CHILD_PID',
|
||||
provider => base,
|
||||
}
|
||||
}
|
4
templates/autossh-command.erb
Normal file
4
templates/autossh-command.erb
Normal file
@ -0,0 +1,4 @@
|
||||
/usr/lib/autossh/autossh -M 0 -N -f -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -o "Stric
|
||||
tHostKeyChecking no" <% if @local_forward_args %> -L <%= @local_forward_args %> <% end %> <% if @rem
|
||||
ote_forward_args %> -R <%= @remote_forward_args %> <% end %> -i <%= @ssh_key %> <%= @ssh_user %>@<%=
|
||||
@ssh_host %> -p <%= @ssh_port %>
|
Loading…
x
Reference in New Issue
Block a user