summaryrefslogtreecommitdiffstats
path: root/fuel-plugin/deployment_scripts/puppet/manifests/kvm-install.pp
blob: 5f14f1a9f34041def8d749078d0c10e368efb0b4 (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
$kvm_settings = hiera('fuel-plugin-kvm')

case $::operatingsystem {
  'Ubuntu': {
    $version         = '4.4.50-rt62nfv'
    $kernel_kit      = ["linux-headers-${version}", "linux-image-${version}"]
    $kernel_src      = "/usr/src/linux-headers-${version}"
    $kernel_src_link = "/lib/modules/${version}/build"

    shellvar { 'GRUB_DEFAULT':
      ensure => present,
      target => '/etc/default/grub',
      value  => "Advanced options for Ubuntu>Ubuntu, with Linux ${version}",
      quoted => 'double',
      notify => Exec['update_grub'],
    }
  }
  default: {
    fail("Unsupported operating system: ${::osfamily}/${::operatingsystem}")
  }

}

if $kvm_settings['use_kvm'] {
  $ensure_pkg  = '1.0.OPNFV'
  $ensure_link = 'link'
} else {
  $ensure_pkg  = 'purged'
  $ensure_link = 'absent'
}

exec { 'update_grub':
  command     => '/usr/sbin/update-grub',
  refreshonly => true,
}

package { $kernel_kit:
  ensure => $ensure_pkg,
  before => File[$kernel_src_link],
}

file { $kernel_src_link:
  ensure => $ensure_link,
  target => $kernel_src,
}