aboutsummaryrefslogtreecommitdiff
path: root/manifests/kvm.pp
blob: 2010cf9c93fdb2a9a793d51ed0bf0bab74a6a298 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class nodo::kvm inherits nodo {
  include syslog-ng
  include initramfs
  include modprobe
  include firewire
  include sysctl
  include ups
  include utils::physical
  include resolver
  include monkeysphere_nodo

  # SSL computational DoS mitigation
  # See http://vincent.bernat.im/en/blog/2011-ssl-dos-mitigation.html
  $firewall_ssl_ratelimit = $firewall_ssl_ratelimit ? {
    ''      => $firewall_global_ssl_ratelimit ? {
      ''      => '-',
      default => $firewall_global_ssl_ratelimit,
    },
    default => $firewall_ssl_ratelimit,
  }

  # Firewall configuration
  include firewall

  # Vserver configuration
  $vserver_vdirbase = "/var/vservers"
  include vserver::host

  if $use_nagios != false {
    if $use_nagios_fqdn == true {
      include nagios::target::fqdn
    }
    else {
      include nagios::target
    }
    nagios::service::ping { "$fqdn": }
  }

  # Time configuration
  case $ntpdate {
    false:   { include timezone }
    default: { include ntpdate  }
  }

  # SSH Server
  #
  # We need to restrict listen address so multiple instances
  # can live together in the same physical host.
  #
  case $sshd_listen_address {
    '': { $sshd_listen_address = [ "$ipaddress" ] }
  }

  class { 'sshd':
    listen_address          => $sshd_listen_address,
    password_authentication => $ssh_password_authentication,
    shared_ip               => $ssh_shared_ip,
    tcp_forwarding          => $ssh_tcp_forwarding,
    hardened_ssl            => $ssh_hardened_ssl,
    print_motd              => $ssh_print_motd,
  }

  backupninja::sys { "sys":
    ensure => present,
  }

  # Munin configuration
  munin_node { "$hostname":
    port => '4900',
  }

  # TODO: remove in the future
  # Removable media folder
  file { [ "/media/usb", "/media/cdrom" ]:
    ensure => absent,
    mode   => 0755,
  }

  # fstab
  file { "/etc/fstab":
    source  => "puppet://$server/modules/nodo/etc/fstab/kvm",
    owner   => "root",
    group   => "root",
    mode    => 0644,
    ensure  => present,
    notify  => Exec['update-initramfs'],
  }

  # crypttab
  file { "/etc/crypttab":
    source  => "puppet://$server/modules/nodo/etc/crypttab/kvm",
    owner   => "root",
    group   => "root",
    mode    => 0644,
    ensure  => present,
    notify  => Exec['update-initramfs'],
  }
}