aboutsummaryrefslogtreecommitdiff
path: root/manifests/xen.pp
blob: 08ca5c353210d0ec648ec4d59e3b0860b375a9ef (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# virtual/xen.pp -- XEN specifica
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.

class munin::plugins::xen {
	munin::remoteplugin {
		xen_mem:	
			source => "puppet://$server/virtual/munin/xen_mem",
			config => "user root";
		xen_vm:
			source => "puppet://$server/virtual/munin/xen_vm",
			config => "user root";
	}
}

class xen::domain {
    case $operatingsystem {
        debian: { include xen::domain::debian }
        centos: { include xen::domain::centos }
        default: { include xen::domain::base }
    }
}

class xen::domain::base {
    service{ 'xend':
        ensure => running,
        enable => true,
        hasstatus => true,
    }

    case $xen_domains {
        '0': { info("No xen domains are running, so not configuring service xendomains") } 
        default: {
            service{ 'xendomains':
                ensure => running,
                enable => true,
                hasstatus => true,
            }
        }
    }

    file{'/etc/xen/xend-config.sxp':
        source => [ "puppet://$server/files/virtual/xen/${fqdn}/config/xend-config.sxp",
                    "puppet://$server/files/virtual/xen/config/${domain}/xend-config.sxp",
                    "puppet://$server/files/virtual/xen/config/${operatingsystem}/xend-config.sxp",
                    "puppet://$server/files/virtual/xen/config/${operatingsystem}/$lsbdistcodename/xend-config.sxp",
                    "puppet://$server/files/virtual/xen/config/xend-config.sxp",
                    "puppet://$server/virtual/xen/config/${operatingsystem}/xend-config.sxp",
                    "puppet://$server/virtual/xen/config/xend-config.sxp" ],
        notify => Service['xend'],
        owner => root, group => 0, mode => 0644;
    }
} 

class xen::domain::centos inherits xen::domain::base {
    package{ 'kernel-xen':
        ensure => present,
    }

    Service[xend]{
        require => Package['kernel-xen'],
    }

    file{'/etc/sysconfig/xend':
        source => "puppet://$server/virtual/xen/${operatingsystem}/sysconfig/xend",
        notify => Service['xend'],
        owner => root, group => 0, mode => 0644;
    }

    file{'/etc/sysconfig/xendomains':
        source => "puppet://$server/virtual/xen/${operatingsystem}/sysconfig/xendomains",
        owner => root, group => 0, mode => 0644;
    }

    case $xen_domains {
        '0': { info("No xen domains are running, so not configuring service xendomains") } 
        default: {
            Service[xendomains]{
                require => Package['kernel-xen'],
            }
            File['/etc/sysconfig/xendomains']{
                notify => Service[xendomains] 
            }
        }
    } 
}

class xen::domain::debian inherits xen::domain::base {
  $xen_linux_system = $architecture ? {
    amd64 => "xen-linux-system-2.6.26-1-xen-amd64",
    i386 => "xen-linux-system-2.6.26-1-xen-686"
  }

  package {
    "$xen_linux_system":
      ensure => present,
      alias => "xen-linux-system";
  }
}


class xen::dom0 inherits xen::domain { 
    case $operatingsystem {
        debian: { include xen::dom0::debian }
        centos: { include xen::dom0::centos }
        default: { include xen::dom0::base }
    }
}

class xen::dom0::base {}

class xen::dom0::centos inherits xen::dom0::base {
    package{ [ "xen", "xen-libs"]:
        ensure => present,
    }
}

class xen::dom0::debian inherits xen::dom0::base {
  package {
    "xen-tools":
      ensure => present;
  }
}