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

Contents of /puppet/modules/auto_installation/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2154 - (show annotations) (download)
Sun Jan 8 12:40:29 2012 UTC (9 years, 10 months ago) by tmb
File size: 4108 byte(s)
fix '(warning): Unrecognised escape sequence '\:' in file /etc/puppet/modules/auto_installation/manifests/init.pp at line 119'
1 # what should be possible :
2 # install a base system
3 # - mandriva
4 # - mageia
5 # - others ? ( for testing package ? )
6
7 # install a server
8 # - by name, with a valstart clone
9
10 class auto_installation {
11 class variables {
12 $pxe_dir = "/var/lib/pxe"
13 # m/ for menu. There is limitation on the path length so
14 # while we will likely not hit the limit, it may be easier
15 $pxe_menu_dir = "$pxe_dir/pxelinux.cfg/m/"
16 }
17
18 class download {
19 import "download.rb"
20 }
21
22 class pxe_menu inherits variables {
23 package { 'syslinux':
24
25 }
26
27 file { $pxe_dir:
28 ensure => directory,
29 }
30
31 file { "$pxe_dir/pxelinux.0":
32 ensure => "/usr/lib/syslinux/pxelinux.0",
33 }
34
35 file { "$pxe_dir/menu.c32":
36 ensure => "/usr/lib/syslinux/menu.c32"
37 }
38
39 file { "$pxe_dir/pxelinux.cfg":
40 ensure => directory,
41 }
42 # m for menu, there is some limitation on the path lenght so I
43 # prefer to
44 file { "$pxe_menu_dir":
45 ensure => directory,
46 }
47
48 # TODO make it tag aware
49 $menu_entries = list_exported_ressources('Auto_installation::Pxe_menu_base')
50 # default file should have exported ressources
51 file { "$pxe_dir/pxelinux.cfg/default":
52 ensure => present,
53 content => template('auto_installation/default'),
54 }
55 Auto_installation::Pxe_menu_base <<| tag == $fqdn |>>
56 }
57
58 define pxe_menu_base($content) {
59 include auto_installation::variables
60 file { "$auto_installation::variables::pxe_menu_dir/$name":
61 ensure => present,
62 content => $content,
63 }
64 }
65
66 define pxe_menu_entry($kernel_path, $append, $label) {
67 @@auto_installation::pxe_menu_base { $name:
68 tag => $fqdn,
69 content => template('auto_installation/menu'),
70 }
71 }
72
73 # define pxe_linux_entry
74 # meant to be exported
75 # name
76 # label
77 # kernel
78 # append
79 class netinst_storage {
80 # to ease the creation of test iso
81 $netinst_path = "/var/lib/libvirt/netinst"
82
83 file { $netinst_path:
84 ensure => directory,
85 require => Package[libvirt-utils],
86 }
87
88 libvirtd::storage { "netinst":
89 path => $netinst_path,
90 require => File[$netinst_path],
91 }
92 }
93
94 define download_file($destination_path, $download_url) {
95 exec { "wget -q -O $destination_path/$name $download_url/$name":
96 creates => "$destination_path/$name",
97 }
98 }
99
100 define mandriva_installation_entry($version, $arch = 'x86_64') {
101 include netinst_storage
102 $protocol = "ftp"
103 $server = "ftp.free.fr"
104 $mirror_url_base = "/pub/Distributions_Linux/MandrivaLinux/"
105 $mirror_url_middle = $version ? {
106 "cooker" => "devel/cooker/$arch/",
107 default => "official/$version/$arch/"
108 }
109 $mirror_url = "$mirror_url_base/$mirror_url_middle"
110
111 $mirror_url_end = "isolinux/alt0"
112
113 $destination_path = "$netinst_storage::netinst_path/$name"
114
115 file { "$destination_path":
116 ensure => directory,
117 }
118
119 $download_url = "$protocol\\://$server/$mirror_url/$mirror_url_end"
120
121
122 download_file { ['all.rdz','vmlinuz']:
123 destination_path => $destination_path,
124 download_url => $download_url,
125 require => File[$destination_path],
126 }
127
128 pxe_menu_entry { "mandriva_$version_$arch":
129 kernel_path => "$name/vmlinuz",
130 label => "Mandriva $version $arch",
131 #TODO add autoinst.cfg
132 append => "$name/all.rdz useless_thing_accepted=1 lang=fr automatic=int:eth0,netw:dhcp,met:$protocol,ser:$server,dir:$mirror_url ",
133 }
134 }
135 #
136 # define a template for autoinst
137 # - basic installation
138 # - server installation ( with server name as a parameter )
139
140 }

  ViewVC Help
Powered by ViewVC 1.1.28