Added amanda module
This commit is contained in:
parent
1389ec553e
commit
8217a3b0f8
3 changed files with 126 additions and 0 deletions
27
amanda/lib/facter/amanda.rb
Normal file
27
amanda/lib/facter/amanda.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
Facter.add('amanda_serverkey') do
|
||||
setcode do
|
||||
begin
|
||||
match = File.read('/var/lib/amanda/.ssh/id_rsa_amdump.pub')[/^ssh-rsa ([^ ]+)/, 1]
|
||||
if match
|
||||
data = match
|
||||
end
|
||||
rescue
|
||||
data = ''
|
||||
end
|
||||
data
|
||||
end
|
||||
end
|
||||
|
||||
Facter.add('amanda_clientkey') do
|
||||
setcode do
|
||||
begin
|
||||
match = File.read('/var/lib/amanda/.ssh/id_rsa_amrecover.pub')[/^ssh-rsa ([^ ]+)/, 1]
|
||||
if match
|
||||
data = match
|
||||
end
|
||||
rescue
|
||||
data = ''
|
||||
end
|
||||
data
|
||||
end
|
||||
end
|
90
amanda/manifests/init.pp
Normal file
90
amanda/manifests/init.pp
Normal file
|
@ -0,0 +1,90 @@
|
|||
class amanda::common {
|
||||
|
||||
file { "/var/lib/amanda/.ssh":
|
||||
ensure => directory,
|
||||
mode => 0700,
|
||||
owner => amandabackup,
|
||||
group => disk,
|
||||
}
|
||||
|
||||
file { "/var/lib/amanda/.ssh/authorized_keys":
|
||||
ensure => present,
|
||||
mode => 0600,
|
||||
owner => amandabackup,
|
||||
group => disk,
|
||||
require => File["/var/lib/amanda/.ssh"],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class amanda::client inherits amanda::common {
|
||||
|
||||
if !$amanda_server {
|
||||
fail("\$amanda_server must be defined.")
|
||||
}
|
||||
|
||||
if !$amanda_client {
|
||||
$amanda_client = $ipaddress
|
||||
}
|
||||
|
||||
include inetd::server
|
||||
|
||||
package { "amanda-enterprise-backup-client":
|
||||
ensure => installed,
|
||||
before => File["/var/lib/amanda/.ssh"],
|
||||
require => Class["inetd::server"],
|
||||
}
|
||||
|
||||
file { [ "/etc/xinetd.d/amandaclient",
|
||||
"/etc/xinetd.d/zmrecover", ]:
|
||||
ensure => absent,
|
||||
notify => Service["xinetd"],
|
||||
require => Package["amanda-enterprise-backup-client"],
|
||||
}
|
||||
|
||||
file { "/etc/amanda/amanda-client.conf":
|
||||
ensure => present,
|
||||
mode => 0644,
|
||||
owner => amandabackup,
|
||||
group => disk,
|
||||
content => template("amanda/amanda-client.conf.erb"),
|
||||
require => Package["amanda-enterprise-backup-client"],
|
||||
}
|
||||
|
||||
if $amanda_clientkey {
|
||||
@@ssh_authorized_key { "amrecover@${homename}":
|
||||
ensure => present,
|
||||
key => "${amanda_clientkey}",
|
||||
type => "ssh-rsa",
|
||||
user => "amandabackup",
|
||||
tag => "amandaclient",
|
||||
options => [ "no-agent-forwarding", "no-port-forwarding", "no-X11-forwarding",
|
||||
"command=\"/usr/lib/amanda/amandad -auth=ssh amindexd amidxtaped\"",
|
||||
"from=\"${amanda_client}\"", ],
|
||||
}
|
||||
}
|
||||
|
||||
Ssh_authorized_key <<| tag == "amandaserver" |>>
|
||||
|
||||
}
|
||||
|
||||
|
||||
class amanda::server inherits amanda::common {
|
||||
|
||||
if $amanda_serverkey {
|
||||
@@ssh_authorized_key { "amdump@${homename}":
|
||||
ensure => present,
|
||||
key => "${amanda_serverkey}",
|
||||
type => "ssh-rsa",
|
||||
user => "amandabackup",
|
||||
tag => "amandaserver",
|
||||
options => [ "no-agent-forwarding", "no-port-forwarding", "no-X11-forwarding",
|
||||
"command=\"/usr/lib/amanda/amandad -auth=ssh amdump\"",
|
||||
"from=\"${amanda_server}\"", ],
|
||||
}
|
||||
}
|
||||
|
||||
Ssh_authorized_key <<| tag == "amandaclient" |>>
|
||||
|
||||
}
|
9
amanda/templates/amanda-client.conf.erb
Normal file
9
amanda/templates/amanda-client.conf.erb
Normal file
|
@ -0,0 +1,9 @@
|
|||
# amanda.conf - sample Amanda client configuration file.
|
||||
#
|
||||
# This file normally goes in /etc/amanda/amanda-client.conf.
|
||||
#
|
||||
|
||||
index_server "<%= amanda_server %>"
|
||||
tape_server "<%= amanda_server %>"
|
||||
auth "ssh"
|
||||
ssh_keys "/var/lib/amanda/.ssh/id_rsa_amrecover"
|
Loading…
Add table
Reference in a new issue