|
| 1 | +class nova::migration::libvirt { |
| 2 | + |
| 3 | + define replace($file, $orig, $new) { |
| 4 | + exec { "Replace ${orig} with ${new} in ${file}": |
| 5 | + path => ['/bin', '/usr/bin'], |
| 6 | + command => "perl -p -i -e 's/^${orig}\$/${new}/g' ${file}", |
| 7 | + unless => "grep -q '^${new}$' ${file}", |
| 8 | + notify => Service['libvirt'], |
| 9 | + } |
| 10 | + } |
| 11 | + |
| 12 | + case $::lsbdistid { |
| 13 | + 'Ubuntu': { |
| 14 | + # Ubuntu-specific, not Debian, due to upstart |
| 15 | + |
| 16 | + file_line { '/etc/libvirt/libvirtd.conf listen_tls': |
| 17 | + path => '/etc/libvirt/libvirtd.conf', |
| 18 | + line => 'listen_tls = 0', |
| 19 | + match => 'listen_tls =', |
| 20 | + notify => Service['libvirt'], |
| 21 | + } |
| 22 | + |
| 23 | + file_line { '/etc/libvirt/libvirtd.conf listen_tcp': |
| 24 | + path => '/etc/libvirt/libvirtd.conf', |
| 25 | + line => 'listen_tcp = 1', |
| 26 | + match => 'listen_tcp =', |
| 27 | + notify => Service['libvirt'], |
| 28 | + } |
| 29 | + |
| 30 | + file_line { '/etc/libvirt/libvirtd.conf auth_tcp': |
| 31 | + path => '/etc/libvirt/libvirtd.conf', |
| 32 | + line => 'auth_tcp = "none"', |
| 33 | + match => 'auth_tcp =', |
| 34 | + notify => Service['libvirt'], |
| 35 | + } |
| 36 | + |
| 37 | + file_line { '/etc/init/libvirt-bin.conf libvirtd opts': |
| 38 | + path => '/etc/init/libvirt-bin.conf', |
| 39 | + line => 'env libvirtd_opts="-d -l"', |
| 40 | + match => 'env libvirtd_opts=', |
| 41 | + } |
| 42 | + |
| 43 | + file_line { '/etc/default/libvirt-bin libvirtd opts': |
| 44 | + path => '/etc/default/libvirt-bin', |
| 45 | + line => 'libvirtd_opts="-d -l"', |
| 46 | + match => 'libvirtd_opts=', |
| 47 | + } |
| 48 | + |
| 49 | + } |
| 50 | + } |
| 51 | +} |
0 commit comments