aboutsummaryrefslogtreecommitdiff
path: root/manifests/kvm/images.pp
blob: 201670843148fbb6c2fed327455f923f840dc9b6 (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
class virtual::kvm::images {
  user { 'iso':
    ensure => present,
    home   => "/usr/local/share/iso",
  }

  file { [ '/usr/local/share/iso', "/usr/local/share/iso/${lsbdistcodename}",
           "/usr/local/share/iso/${lsbdistcodename}/installer", "/usr/local/share/iso/${lsbdistcodename}/installer/profiles" ]:
    ensure  => directory,
    owner   => iso,
    group   => iso,
    mode    => '0755',
    require => User['iso'],
  }

  file { "/usr/local/share/iso/${lsbdistcodename}/installer/profiles/kvm-unencrypted.preseed":
    ensure  => present,
    owner   => root,
    group   => root,
    mode    => '0644',
    source  => 'puppet:///modules/virtual/kvm/kvm-unencrypted.preseed',
    require => File["/usr/local/share/iso/${lsbdistcodename}/installer/profiles"],
  }

  exec { "build-simple-cdd-${lsbdistcodename}":
    command => '/usr/bin/build-simple-cdd --serial-console --profiles kvm-unencrypted',
    user    => 'iso',
    timeout => 0,
    cwd     => "/usr/local/share/iso/${lsbdistcodename}/installer",
    creates => "/usr/local/share/iso/${lsbdistcodename}/installer/images/debian-${lsbdistrelease}-${architecture}-CD-1.iso", 
    require => [ File["/usr/local/share/iso/${lsbdistcodename}/installer/profiles/kvm-unencrypted.preseed"], Package['simple-cdd'] ],
  }

  exec { "debirf-make-profile-rescue-${lsbdistcodename}":
    command => 'tar xzf /usr/share/doc/debirf/example-profiles/rescue.tgz',
    user    => 'iso',
    cwd     => "/usr/local/share/iso/${lsbdistcodename}",
    creates => "/usr/local/share/iso/${lsbdistcodename}/rescue",
    require => [ File["/usr/local/share/iso/${lsbdistcodename}"], Package['debirf'] ],
  }

  exec { "debirf-make-rescue-${lsbdistcodename}":
    command => '/usr/bin/debirf make -n rescue',
    user    => 'iso',
    timeout => 0,
    creates => "/usr/local/share/iso/${lsbdistcodename}/rescue/vmlinuz-${kernelrelease}",
    cwd     => "/usr/local/share/iso/${lsbdistcodename}",
    require => Exec["debirf-make-profile-rescue-${lsbdistcodename}"],
  }

  exec { "debirf-makeiso-rescue-${lsbdistcodename}":
    command => '/usr/bin/debirf makeiso rescue',
    user    => 'iso',
    timeout => 0,
    creates => "/usr/local/share/iso/${lsbdistcodename}/rescue/debirf-rescue_${lsbdistcodename}_${kernelrelease}.iso",
    cwd     => "/usr/local/share/iso/${lsbdistcodename}",
    require => Exec["debirf-make-rescue-${lsbdistcodename}"],
  }
}