/[adm]/puppet/modules/libvirtd/manifests/init.pp
ViewVC logotype

Diff of /puppet/modules/libvirtd/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2663 by misc, Mon Jan 16 15:25:07 2012 UTC revision 2664 by misc, Tue Mar 20 17:42:17 2012 UTC
# Line 5  class libvirtd { Line 5  class libvirtd {
5          # netcat-openbsd -> for ssh remote access          # netcat-openbsd -> for ssh remote access
6          # iptables -> for dhcp, message error was quite puzzling          # iptables -> for dhcp, message error was quite puzzling
7          # python-* => needed for helper script          # python-* => needed for helper script
8          package { ["libvirt-utils","dnsmasq-base","netcat-openbsd","iptables","python-libvirt","python-IPy"]:          package {['libvirt-utils',
9                      'dnsmasq-base',
10                      'netcat-openbsd',
11                      'iptables',
12                      'python-libvirt',
13                      'python-IPy']:
14    
15          }          }
16    
17          service { libvirtd:          service { 'libvirtd':
18              require => Package['libvirt-utils'],              require => Package['libvirt-utils'],
19          }          }
20    
21          #TODO remove once libvirt package is fixed to manage the directory          #TODO remove once libvirt package is fixed to manage the directory
22          file { ["/etc/libvirt/storage","/etc/libvirt/storage/autostart"]:          file { ['/etc/libvirt/storage',
23              ensure => directory,                  '/etc/libvirt/storage/autostart']:
24                ensure  => directory,
25              require => Package['libvirt-utils'],              require => Package['libvirt-utils'],
26          }          }
27    
28          file { "/usr/local/bin/storage_add.py":          file { '/usr/local/bin/storage_add.py':
29              mode => 755,              mode   => '0755',
30              source => "puppet:///modules/libvirtd/storage_add.py",              source => 'puppet:///modules/libvirtd/storage_add.py',
31          }          }
32    
33          file { "/usr/local/bin/network_add.py":          file { '/usr/local/bin/network_add.py':
34              mode => 755,              mode   => '0755',
35              source => "puppet:///modules/libvirtd/network_add.py",              source => 'puppet:///modules/libvirtd/network_add.py',
36          }          }
37    
38      }      }
39    
40      class kvm inherits base {      class kvm inherits base {
41          # pull cyrus-sasl, should be checked          # pull cyrus-sasl, should be checked
42          package { "qemu": }          package { 'qemu': }
43        
44      }      }
45    
46      # see http://wiki.libvirt.org/page/SSHPolicyKitSetup      # see http://wiki.libvirt.org/page/SSHPolicyKitSetup
# Line 41  class libvirtd { Line 48  class libvirtd {
48          # to pull polkit and create the directory          # to pull polkit and create the directory
49          include libvirtd::base          include libvirtd::base
50          file { "/etc/polkit-1/localauthority/50-local.d/50-$name-libvirt-remote-access.pkla":          file { "/etc/polkit-1/localauthority/50-local.d/50-$name-libvirt-remote-access.pkla":
51              content => template("libvirtd/50-template-libvirt-remote-access.pkla"),              content => template('libvirtd/50-template-libvirt-remote-access.pkla'),
52              require => Package['libvirt-utils'],              require => Package['libvirt-utils'],
53          }          }
54      }      }
# Line 52  class libvirtd { Line 59  class libvirtd {
59          exec { "/usr/local/bin/storage_add.py $name $path":          exec { "/usr/local/bin/storage_add.py $name $path":
60              creates => "/etc/libvirt/storage/$name.xml",              creates => "/etc/libvirt/storage/$name.xml",
61              require => [File['/usr/local/bin/storage_add.py'],              require => [File['/usr/local/bin/storage_add.py'],
62                          Package["python-libvirt"] ]                          Package['python-libvirt'] ]
63          }          }
64    
65          #TODO use API of libvirt          #TODO use API of libvirt
66          file { "/etc/libvirt/storage/autostart/$name.xml":          file { "/etc/libvirt/storage/autostart/$name.xml":
67              ensure => $autostart ? {              ensure => $autostart ? {
68                              true => "/etc/libvirt/storage/$name.xml",                              true  => "/etc/libvirt/storage/$name.xml",
69                              false => "absent"                              false => absent
70                        },                        },
71              require => Package['libvirt-utils'],              require => Package['libvirt-utils'],
72          }          }
# Line 70  class libvirtd { Line 77  class libvirtd {
77                      $forward_dev = 'eth0',                      $forward_dev = 'eth0',
78                      $network = '192.168.122.0/24',                      $network = '192.168.122.0/24',
79                      $tftp_root = '',                      $tftp_root = '',
80                      $disable_pxe = '',                      $disable_pxe = '',
81                      $autostart = true,                      $autostart = true,
82                      $vm_type = 'qemu') {                      $vm_type = 'qemu') {
83    
84          exec { "/usr/local/bin/network_add.py":          exec { '/usr/local/bin/network_add.py':
85              environment => ["BRIDGE_NAME=$bridge_name",              environment => ["BRIDGE_NAME=$bridge_name",
86                              "FORWARD=$forward",                              "FORWARD=$forward",
87                              "FORWARD_DEV=$forward_dev",                              "FORWARD_DEV=$forward_dev",
88                              "NETWORK=$network",                              "NETWORK=$network",
89                              "TFTP_ROOT=$tftp_root",                              "TFTP_ROOT=$tftp_root",
90                              "DISABLE_PXE=\"$disable_pxe\""],                              "DISABLE_PXE=\"$disable_pxe\""],
91                
92              creates => "/etc/libvirt/$vm_type/networks/$name.xml",              creates => "/etc/libvirt/$vm_type/networks/$name.xml",
93              require => [File['/usr/local/bin/network_add.py'],              require => [File['/usr/local/bin/network_add.py'],
94                          Package['python-IPy'], Package["python-libvirt"] ]                          Package['python-IPy'], Package["python-libvirt"] ]
# Line 90  class libvirtd { Line 97  class libvirtd {
97          #TODO use API of libvirt          #TODO use API of libvirt
98          file { "/etc/libvirt/$vm_type/networks/autostart/$name.xml":          file { "/etc/libvirt/$vm_type/networks/autostart/$name.xml":
99              ensure => $autostart ? {              ensure => $autostart ? {
100                              true => "/etc/libvirt/$vm_type/networks/$name.xml",                              true  => "/etc/libvirt/$vm_type/networks/$name.xml",
101                              false => "absent"                              false => absent
102                        },                        },
103              require => Package['libvirt-utils'],              require => Package['libvirt-utils'],
104          }          }

Legend:
Removed from v.2663  
changed lines
  Added in v.2664

  ViewVC Help
Powered by ViewVC 1.1.30