veewee 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/Gemfile +4 -0
  2. data/README.md +1 -1
  3. data/doc/definition.md +18 -0
  4. data/doc/kvm.md +28 -1
  5. data/doc/template.md +53 -2
  6. data/lib/veewee/command/fusion.rb +37 -3
  7. data/lib/veewee/command/vagrant/basebox.rb +2 -0
  8. data/lib/veewee/command/vagrant/winrm.rb +39 -0
  9. data/lib/veewee/command/vbox.rb +18 -0
  10. data/lib/veewee/definition.rb +13 -3
  11. data/lib/veewee/error.rb +3 -0
  12. data/lib/veewee/provider/core/box.rb +7 -0
  13. data/lib/veewee/provider/core/box/build.rb +34 -14
  14. data/lib/veewee/provider/core/box/copy.rb +17 -0
  15. data/lib/veewee/provider/core/box/exec.rb +31 -12
  16. data/lib/veewee/provider/core/box/floppy.rb +1 -0
  17. data/lib/veewee/provider/core/box/halt.rb +7 -3
  18. data/lib/veewee/provider/core/box/validate_tags.rb +8 -2
  19. data/lib/veewee/provider/core/box/wincp.rb +120 -0
  20. data/lib/veewee/provider/core/box/winrm.rb +59 -0
  21. data/lib/veewee/provider/core/helper/comm.rb +47 -0
  22. data/lib/veewee/provider/core/helper/web.rb +20 -9
  23. data/lib/veewee/provider/core/helper/winrm.rb +167 -0
  24. data/lib/veewee/provider/kvm/box/create.rb +59 -3
  25. data/lib/veewee/provider/kvm/provider.rb +6 -6
  26. data/lib/veewee/provider/parallels/box/helper/buildinfo.rb +1 -1
  27. data/lib/veewee/provider/virtualbox/box.rb +1 -0
  28. data/lib/veewee/provider/virtualbox/box/build.rb +4 -2
  29. data/lib/veewee/provider/virtualbox/box/create.rb +32 -12
  30. data/lib/veewee/provider/virtualbox/box/helper/buildinfo.rb +6 -3
  31. data/lib/veewee/provider/virtualbox/box/helper/create.rb +20 -5
  32. data/lib/veewee/provider/virtualbox/box/helper/winrm_options.rb +31 -0
  33. data/lib/veewee/provider/virtualbox/box/up.rb +33 -12
  34. data/lib/veewee/provider/virtualbox/box/winrm.rb +13 -0
  35. data/lib/veewee/provider/vmfusion/box.rb +2 -0
  36. data/lib/veewee/provider/vmfusion/box/add_share.rb +18 -0
  37. data/lib/veewee/provider/vmfusion/box/build.rb +3 -1
  38. data/lib/veewee/provider/vmfusion/box/create.rb +7 -2
  39. data/lib/veewee/provider/vmfusion/box/helper/buildinfo.rb +9 -6
  40. data/lib/veewee/provider/vmfusion/box/helper/ip.rb +1 -1
  41. data/lib/veewee/provider/vmfusion/box/helper/winrm_options.rb +21 -0
  42. data/lib/veewee/provider/vmfusion/box/template.rb +7 -3
  43. data/lib/veewee/provider/vmfusion/box/template.vmx.erb +6 -0
  44. data/lib/veewee/provider/vmfusion/box/winrm.rb +12 -0
  45. data/lib/veewee/provider/vmfusion/provider.rb +7 -1
  46. data/lib/veewee/version.rb +1 -1
  47. data/templates/CentOS-5.6-x86_64-netboot-packages/definition.rb +16 -0
  48. data/templates/CentOS-5.6-x86_64-netboot-packages/ks.cfg +47 -0
  49. data/templates/CentOS-5.6-x86_64-netboot-packages/postinstall.sh +61 -0
  50. data/templates/Debian-7.0-b3-amd64-netboot/base.sh +27 -0
  51. data/templates/Debian-7.0-b3-amd64-netboot/chef.sh +2 -0
  52. data/templates/Debian-7.0-b3-amd64-netboot/cleanup-virtualbox.sh +4 -0
  53. data/templates/Debian-7.0-b3-amd64-netboot/cleanup.sh +17 -0
  54. data/templates/Debian-7.0-b3-amd64-netboot/definition.rb +51 -0
  55. data/templates/Debian-7.0-b3-amd64-netboot/preseed.cfg +313 -0
  56. data/templates/Debian-7.0-b3-amd64-netboot/puppet.sh +2 -0
  57. data/templates/Debian-7.0-b3-amd64-netboot/ruby.sh +10 -0
  58. data/templates/Debian-7.0-b3-amd64-netboot/vagrant.sh +25 -0
  59. data/templates/Debian-7.0-b3-amd64-netboot/virtualbox.sh +13 -0
  60. data/templates/Debian-7.0-b3-amd64-netboot/zerodisk.sh +3 -0
  61. data/templates/Fedora-18-i386/definition.rb +17 -0
  62. data/templates/Fedora-18-i386/ks.cfg +75 -0
  63. data/templates/Fedora-18-i386/postinstall.sh +38 -0
  64. data/templates/Fedora-18-x86_64/definition.rb +17 -0
  65. data/templates/Fedora-18-x86_64/ks.cfg +75 -0
  66. data/templates/Fedora-18-x86_64/postinstall.sh +38 -0
  67. data/templates/OracleLinux-6.3-x86_64-DVD/base.sh +30 -0
  68. data/templates/OracleLinux-6.3-x86_64-DVD/chef.sh +3 -0
  69. data/templates/OracleLinux-6.3-x86_64-DVD/cleanup.sh +5 -0
  70. data/templates/OracleLinux-6.3-x86_64-DVD/definition.rb +40 -0
  71. data/templates/OracleLinux-6.3-x86_64-DVD/ks.cfg +42 -0
  72. data/templates/OracleLinux-6.3-x86_64-DVD/puppet.sh +12 -0
  73. data/templates/OracleLinux-6.3-x86_64-DVD/ruby.sh +3 -0
  74. data/templates/OracleLinux-6.3-x86_64-DVD/vagrant.sh +18 -0
  75. data/templates/OracleLinux-6.3-x86_64-DVD/virtualbox.sh +8 -0
  76. data/templates/OracleLinux-6.3-x86_64-DVD/zerodisk.sh +3 -0
  77. data/templates/funtoo-latest-x86_64/definition.rb +37 -0
  78. data/templates/funtoo-latest-x86_64/postinstall.sh +401 -0
  79. data/templates/openbsd50_amd64/definition.rb +3 -2
  80. data/templates/openbsd50_amd64/postinstall.sh +4 -4
  81. data/templates/openbsd50_i386/definition.rb +4 -4
  82. data/templates/openbsd52_amd64/README +28 -0
  83. data/templates/openbsd52_amd64/definition.rb +85 -0
  84. data/templates/openbsd52_amd64/postinstall.sh +81 -0
  85. data/templates/openbsd52_i386/README +28 -0
  86. data/templates/openbsd52_i386/definition.rb +85 -0
  87. data/templates/openbsd52_i386/postinstall.sh +81 -0
  88. data/templates/windows-2008R1-serverstandard-amd64/Autounattend.xml +6 -6
  89. data/templates/windows-2008R1-serverweb-amd64/install-winrm.bat +1 -1
  90. data/templates/windows-2008R2-serverstandard-amd64-winrm/Autounattend.xml +224 -0
  91. data/templates/windows-2008R2-serverstandard-amd64-winrm/README.md +87 -0
  92. data/templates/windows-2008R2-serverstandard-amd64-winrm/definition.rb +33 -0
  93. data/templates/windows-2008R2-serverstandard-amd64-winrm/install-chef.bat +2 -0
  94. data/templates/windows-2008R2-serverstandard-amd64-winrm/install-vbox.bat +4 -0
  95. data/templates/windows-2008R2-serverstandard-amd64-winrm/oracle-cert.cer +0 -0
  96. data/templates/windows-2008R2-serverstandard-amd64-winrm/postinstall.sh +74 -0
  97. data/templates/windows-7-enterprise-amd64-winrm/Autounattend.xml +227 -0
  98. data/templates/windows-7-enterprise-amd64-winrm/README.md +52 -0
  99. data/templates/windows-7-enterprise-amd64-winrm/definition.rb +27 -0
  100. data/templates/windows-7-enterprise-amd64-winrm/install-chef.bat +2 -0
  101. data/templates/windows-7-enterprise-amd64-winrm/install-fusion.bat +18 -0
  102. data/templates/windows-7-enterprise-amd64-winrm/install-puppet.bat +4 -0
  103. data/templates/windows-7-enterprise-amd64-winrm/install-vbox.bat +4 -0
  104. data/templates/windows-7-enterprise-amd64-winrm/oracle-cert.cer +0 -0
  105. data/templates/windows-7-enterprise-amd64-winrm/postinstall.bat +74 -0
  106. data/validation/veewee-windows.feature +34 -0
  107. data/veewee.gemspec +1 -1
  108. metadata +73 -7
@@ -31,6 +31,15 @@ module Veewee
31
31
  end
32
32
  end
33
33
 
34
+ def add_winrm_nat_mapping
35
+
36
+ unless definition.nil?
37
+ #Map SSH Ports
38
+ command="#{@vboxcmd} modifyvm '#{name}' --natpf1 'guestwinrm,tcp,,#{definition.winrm_host_port},,#{definition.winrm_guest_port}'"
39
+ shell_exec("#{command}")
40
+ end
41
+ end
42
+
34
43
  def add_shared_folder
35
44
  command="#{@vboxcmd} sharedfolder add \"#{name}\" --name \"veewee-validation\" --hostpath \"#{File.expand_path(env.validation_dir)}\" --automount"
36
45
  shell_exec("#{command}")
@@ -75,8 +84,7 @@ module Veewee
75
84
 
76
85
  end
77
86
 
78
- def attach_disk
79
-
87
+ def attach_disk_common(storagectl, device_number)
80
88
  place=get_vbox_home
81
89
  location=name+"."+definition.disk_format.downcase
82
90
 
@@ -84,16 +92,23 @@ module Veewee
84
92
  ui.info "Attaching disk: #{location}"
85
93
 
86
94
  #command => "${vboxcmd} storageattach \"${vname}\" --storagectl \"SATA Controller\" --port 0 --device 0 --type hdd --medium \"${vname}.vdi\"",
87
- command ="#{@vboxcmd} storageattach \"#{name}\" --storagectl \"SATA Controller\" --port 0 --device 0 --type hdd --medium \"#{location}\""
95
+ command ="#{@vboxcmd} storageattach \"#{name}\" --storagectl \"#{storagectl}\" --port 0 --device #{device_number} --type hdd --medium \"#{location}\""
88
96
  shell_exec("#{command}")
97
+ end
98
+
99
+ def attach_disk_ide(device_number=0)
100
+ self.attach_disk_common("IDE Controller", device_number)
101
+ end
89
102
 
103
+ def attach_disk_sata(device_number=0)
104
+ self.attach_disk_common("SATA Controller", device_number)
90
105
  end
91
106
 
92
107
 
93
- def attach_isofile
108
+ def attach_isofile(device_number=0)
94
109
  full_iso_file=File.join(env.config.veewee.iso_dir,definition.iso_file)
95
110
  ui.info "Mounting cdrom: #{full_iso_file}"
96
- command ="#{@vboxcmd} storageattach \"#{name}\" --storagectl \"IDE Controller\" --type dvddrive --port 0 --device 0 --medium \"#{full_iso_file}\""
111
+ command ="#{@vboxcmd} storageattach \"#{name}\" --storagectl \"IDE Controller\" --type dvddrive --port 0 --device #{device_number} --medium \"#{full_iso_file}\""
97
112
  shell_exec("#{command}")
98
113
  end
99
114
 
@@ -0,0 +1,31 @@
1
+ module Veewee
2
+ module Provider
3
+ module Virtualbox
4
+ module BoxCommand
5
+
6
+ def winrm_options
7
+ port=definition.winrm_host_port
8
+ if self.exists?
9
+ forward=self.forwarding("guestwinrm")
10
+ unless forward.nil?
11
+ port=forward[:host_port]
12
+ end
13
+ end
14
+
15
+ winrm_options={
16
+ :user => definition.winrm_user,
17
+ :pass => definition.winrm_password,
18
+ :port => port,
19
+ # :port => (port.to_i+1).to_s, # debug, by running charles with a reverse proxy
20
+ :basic_auth_only => true,
21
+ :timeout => definition.winrm_login_timeout.to_i,
22
+ :operation_timeout => 600 # ten minutes
23
+ }
24
+ return winrm_options
25
+
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
@@ -13,20 +13,41 @@ module Veewee
13
13
 
14
14
  raise Veewee::Error,"Box is already running" if self.running?
15
15
 
16
- # Before we start,correct the ssh port if needed
17
- forward=self.forwarding("guestssh")
18
- guessed_port=guess_free_port(definition.ssh_host_port.to_i,definition.ssh_host_port.to_i+40).to_s
19
- definition.ssh_host_port=guessed_port.to_s
20
-
21
- unless forward.nil?
22
- if guessed_port!=forward[:guest_port]
23
- # Remove the existing one
24
- self.delete_forwarding("guestssh")
25
- ui.warn "Changing ssh port from #{forward[:guest_port]} to #{guessed_port}"
26
- self.add_ssh_nat_mapping
16
+ if definition.winrm_user && definition.winrm_password # prefer winrm
17
+ # Before we start,correct the ssh/winrm port if needed
18
+ forward=self.forwarding("guestwinrm")
19
+ guessed_port=guess_free_port(definition.winrm_host_port.to_i,definition.winrm_host_port.to_i+40).to_s
20
+ definition.winrm_host_port=guessed_port.to_s
21
+
22
+ unless forward.nil?
23
+ if guessed_port!=forward[:guest_port]
24
+ # Remove the existing one
25
+ self.delete_forwarding("guestwinrm")
26
+ env.ui.warn "Changing winrm port on UP from #{forward[:guest_port]} to #{guessed_port}"
27
+ self.add_winrm_nat_mapping
28
+ end
29
+ else
30
+ self.add_winrm_nat_mapping
27
31
  end
32
+
28
33
  else
29
- self.add_ssh_nat_mapping
34
+
35
+ # Before we start,correct the ssh port if needed
36
+ forward=self.forwarding("guestssh")
37
+ guessed_port=guess_free_port(definition.ssh_host_port.to_i,definition.ssh_host_port.to_i+40).to_s
38
+ definition.ssh_host_port=guessed_port.to_s
39
+
40
+ unless forward.nil?
41
+ if guessed_port!=forward[:guest_port]
42
+ # Remove the existing one
43
+ self.delete_forwarding("guestssh")
44
+ env.ui.warn "Changing ssh port from #{forward[:guest_port]} to #{guessed_port}"
45
+ self.add_ssh_nat_mapping
46
+ end
47
+ else
48
+ self.add_ssh_nat_mapping
49
+ end
50
+
30
51
  end
31
52
 
32
53
  self.suppress_messages
@@ -0,0 +1,13 @@
1
+ module Veewee
2
+ module Provider
3
+ module Virtualbox
4
+ module BoxCommand
5
+
6
+ def winrm(command,options={})
7
+ super(command,options)
8
+ end
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -5,6 +5,7 @@ require 'veewee/provider/core/helper/tcp'
5
5
  require 'veewee/provider/vmfusion/box/helper/status'
6
6
  require 'veewee/provider/vmfusion/box/helper/ip'
7
7
  require 'veewee/provider/vmfusion/box/helper/ssh_options'
8
+ require 'veewee/provider/vmfusion/box/helper/winrm_options'
8
9
  require 'veewee/provider/vmfusion/box/helper/vnc'
9
10
  require 'veewee/provider/vmfusion/box/helper/console_type'
10
11
  require 'veewee/provider/vmfusion/box/helper/buildinfo'
@@ -19,6 +20,7 @@ require 'veewee/provider/vmfusion/box/ssh'
19
20
  require 'veewee/provider/vmfusion/box/template'
20
21
  require 'veewee/provider/vmfusion/box/validate_vmfusion'
21
22
  require 'veewee/provider/vmfusion/box/export_ova'
23
+ require 'veewee/provider/vmfusion/box/add_share'
22
24
 
23
25
 
24
26
  module Veewee
@@ -0,0 +1,18 @@
1
+ module Veewee
2
+ module Provider
3
+ module Vmfusion
4
+ module BoxCommand
5
+ # This function 'adds a share' the box based on the definition
6
+ def add_share(share_name, share_path)
7
+ shell_exec("#{(vmrun_cmd).shellescape} -T fusion addSharedFolder #{vmx_file_path.shellescape} '#{share_name}' #{::File.expand_path(share_path).shellescape}")
8
+ end
9
+
10
+ def add_share_from_defn
11
+ definition.add_shares.each do |share_name, share_path|
12
+ add_share(share_name, share_path)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,5 @@
1
+
2
+
1
3
  module Veewee
2
4
  module Provider
3
5
  module Vmfusion
@@ -5,8 +7,8 @@ module Veewee
5
7
 
6
8
  def build(options)
7
9
  super(options)
10
+ add_share_from_defn
8
11
  end
9
-
10
12
  end
11
13
  end
12
14
  end
@@ -43,16 +43,21 @@ module Veewee
43
43
  fusion_definition=definition.dup
44
44
 
45
45
  fusion_definition.os_type_id=fusion_os_type(definition.os_type_id)
46
-
46
+
47
47
  FileUtils.mkdir_p(vm_path)
48
48
  current_dir=FileUtils.pwd
49
49
  FileUtils.chdir(vm_path)
50
+
51
+ unless definition.vmdk_file.nil?
52
+ src = "#{File.join(definition.path,definition.vmdk_file)}"
53
+ FileUtils.cp(src, vm_path)
54
+ end
55
+
50
56
  aFile = File.new(vmx_file_path, "w")
51
57
  aFile.write(vmx_template(fusion_definition))
52
58
  aFile.close
53
59
  FileUtils.chdir(current_dir)
54
60
  end
55
-
56
61
  end
57
62
  end
58
63
  end
@@ -40,12 +40,15 @@ module Veewee
40
40
  # When we get here, ssh is available and no postinstall scripts have been executed yet
41
41
  # So we begin by transferring the ISO file of the vmware tools
42
42
 
43
- env.logger.info "About to transfer vmware tools iso buildinfo to the box #{name} - #{ip_address} - #{ssh_options}"
44
- iso_image=guest_iso_path
45
- if File.exists?(iso_image)
46
- self.scp(iso_image,File.basename(iso_image))
47
- else
48
- raise Veewee::Error, "We could not find the file #{iso_image}. In newer versions of Fusion, you might have to download the Guest Additions yourself. You can do this by first manually creating a vm and than 'installing the guest additions'"
43
+ if not (definition.winrm_user && definition.winrm_password)
44
+ # with windows, we just use the mounted volume
45
+ env.logger.info "About to transfer vmware tools iso buildinfo to the box #{name} - #{ip_address} - #{ssh_options}"
46
+ iso_image=guest_iso_path
47
+ if File.exists?(iso_image)
48
+ self.copy_to_box(iso_image,File.basename(iso_image))
49
+ else
50
+ raise Veewee::Error, "We could not find the file #{iso_image}. In newer versions of Fusion, you might have to download the Guest Additions yourself. You can do this by first manually creating a vm and than 'installing the guest additions'"
51
+ end
49
52
  end
50
53
  end
51
54
 
@@ -25,7 +25,7 @@ module Veewee
25
25
  raise ::Fission::Error,"VM #{name} does not exist" unless self.exists?
26
26
 
27
27
  unless mac_address.nil?
28
- lease = Fission::Lease.all.data.find { |l| l.mac_address=mac_address}
28
+ lease = Fission::Lease.find_by_mac_address(mac_address).data
29
29
  return lease.ip_address unless lease.nil?
30
30
  return nil
31
31
  else
@@ -0,0 +1,21 @@
1
+ module Veewee
2
+ module Provider
3
+ module Vmfusion
4
+ module BoxCommand
5
+
6
+ def winrm_options
7
+ winrm_options={
8
+ :user => definition.winrm_user,
9
+ :pass => definition.winrm_password,
10
+ :port => definition.winrm_host_port,
11
+ :basic_auth_only => true,
12
+ :timeout => definition.winrm_login_timeout.to_i,
13
+ :operation_timeout => 600 # ten minutes
14
+ }
15
+ return winrm_options
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
@@ -17,14 +17,16 @@ module Veewee
17
17
  unless definition.floppy_files.nil?
18
18
  floppy_path=File.join(definition.path,'virtualfloppy.img')
19
19
  end
20
-
20
+
21
21
  # Depending on the fusion version, we need to update the virtualhw version
22
22
  if @provider.fusion_version.start_with?('5.')
23
23
  virtualhw_version = 9
24
24
  else
25
25
  virtualhw_version = 7
26
26
  end
27
-
27
+
28
+ puts definition.vmdk_file
29
+ vmdk_file = File.basename(definition.vmdk_file) unless definition.vmdk_file.nil?
28
30
  # Setup the variables for in the erb template
29
31
  data = {
30
32
  :cpu_count => definition.cpu_count, :memory_size => definition.memory_size,
@@ -35,7 +37,9 @@ module Veewee
35
37
  :mac_addres => "auto generated",
36
38
  :iso_file => "#{File.join(env.config.veewee.iso_dir,definition.iso_file)}",
37
39
  :box_name => name,
38
- :vnc_port => guess_vnc_port
40
+ :vnc_port => guess_vnc_port,
41
+ :fusion_version => @provider.fusion_version,
42
+ :vmdk_file => vmdk_file
39
43
  }
40
44
 
41
45
  vars = ErbBinding.new(data)
@@ -82,3 +82,9 @@ ethernet0.displayName = "Ethernet"
82
82
  sound.startConnected = "FALSE"
83
83
  RemoteDisplay.vnc.enabled = "TRUE"
84
84
  RemoteDisplay.vnc.port = "<%= vnc_port %>"
85
+ <% if fusion_version.start_with?('5.') %>bios.bootOrder = "hdd,CDROM"<% end %>
86
+ <% unless vmdk_file.nil? %>
87
+ scsi0:2.present = "TRUE"
88
+ scsi0:2.fileName = "<%= vmdk_file %>"
89
+ scsi0:2.redo = ""
90
+ <% end %>
@@ -0,0 +1,12 @@
1
+ module Veewee
2
+ module Provider
3
+ module Vmfusion
4
+ module BoxCommand
5
+
6
+ def winrm(command,options = {})
7
+ super(command,options)
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -27,7 +27,13 @@ module Veewee
27
27
  env.logger.info("Checking version by querying the system_profiler")
28
28
  env.logger.debug(shell_results.stdout)
29
29
 
30
- version = shell_results.stdout.split(/VMware/)[1].split(/\n/)[2].split(/:/)[1].strip
30
+ if (shell_results.stdout == "")
31
+ ui.warn "Could not detect the exact version of vmware. assuming 5.1"
32
+ version = "5.1"
33
+ else
34
+ version = shell_results.stdout.split(/VMware/)[1].split(/\n/)[2].split(/:/)[1].strip
35
+ end
36
+
31
37
  return version
32
38
  end
33
39
 
@@ -4,5 +4,5 @@ end
4
4
 
5
5
  # Only set the version constant if it wasn't set before
6
6
  unless defined?(Veewee::VERSION)
7
- ::Veewee::VERSION="0.3.1"
7
+ ::Veewee::VERSION="0.3.2"
8
8
  end
@@ -0,0 +1,16 @@
1
+ Veewee::Definition.declare({
2
+ :cpu_count => '1', :memory_size=> '384',
3
+ :disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off', :ioapic => 'on', :pae => 'on',
4
+ :os_type_id => 'RedHat_64',
5
+ :iso_file => "CentOS-5.6-x86_64-netinstall.iso",
6
+ :iso_src => "http://vault.centos.org/5.6/isos/x86_64/CentOS-5.6-x86_64-netinstall.iso",
7
+ :iso_md5 => "02cf3a5e32aaa5eed27af775ad292beb",
8
+ :iso_download_timeout => 1000,
9
+ :boot_wait => "10", :boot_cmd_sequence => [ 'linux text ks=http://%IP%:%PORT%/ks.cfg<Enter>' ],
10
+ :kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
11
+ :ssh_login_timeout => "10000", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
12
+ :ssh_host_port => "7222", :ssh_guest_port => "22",
13
+ :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
14
+ :shutdown_cmd => "/sbin/halt -h -p",
15
+ :postinstall_files => [ "postinstall.sh"], :postinstall_timeout => 10000
16
+ })
@@ -0,0 +1,47 @@
1
+ # Kickstart file automatically generated by anaconda.
2
+
3
+ install
4
+ url --url=http://vault.centos.org/5.6/os/x86_64
5
+ lang en_US.UTF-8
6
+ langsupport --default=en_US.UTF-8 en_US.UTF-8
7
+ keyboard us
8
+ xconfig --card "VMWare" --videoram 16384 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16
9
+ network --device eth0 --bootproto dhcp
10
+ rootpw --iscrypted $1$vSG8FjAu$ekQ0grf16hS4G93HTPcco/
11
+ firewall --enabled --trust eth0 --ssh
12
+ selinux --enforcing
13
+ authconfig --enableshadow --enablemd5
14
+ timezone Europe/London
15
+ bootloader --location=mbr
16
+ # The following is the partition information you requested
17
+ # Note that any partitions you deleted are not expressed
18
+ # here so unless you clear all partitions first, this is
19
+ # not guaranteed to work
20
+ clearpart --all --drives=sda --initlabel
21
+ part /boot --fstype ext3 --size=100 --ondisk=sda
22
+ part pv.2 --size=0 --grow --ondisk=sda
23
+ volgroup VolGroup00 --pesize=32768 pv.2
24
+ logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=528 --grow --maxsize=1056
25
+ logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
26
+ reboot
27
+
28
+ %packages
29
+ #@ admin-tools
30
+ #@ text-internet
31
+ #@ dialup
32
+ #@ smb-server
33
+ #@ web-server
34
+ #@ printing
35
+ #@ server-cfg
36
+ @ core
37
+ grub
38
+ e2fsprogs
39
+ lvm2
40
+ kernel
41
+ kernel-devel
42
+
43
+ %post
44
+ /usr/sbin/groupadd vagrant
45
+ /usr/sbin/useradd vagrant -g vagrant -G wheel
46
+ echo "vagrant"|passwd --stdin vagrant
47
+ echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
@@ -0,0 +1,61 @@
1
+ # based on http://chrisadams.me.uk/2010/05/10/setting-up-a-centos-base-box-for-development-and-testing-with-vagrant/
2
+ # but with all the source building moved to packages & puppet focussed
3
+
4
+ date > /etc/vagrant_box_build_time
5
+
6
+ fail()
7
+ {
8
+ echo "FATAL: $*"
9
+ exit 1
10
+ }
11
+
12
+ #kernel source is needed for vbox additions
13
+ yum -y install gcc bzip2 make
14
+ # kernel-devel-`uname -r` is now installed in the KS to ensure we get matching kernel & kernel-devel on the first boot
15
+ #yum -y update
16
+ #yum -y upgrade
17
+
18
+ yum -y install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel
19
+ yum -y erase gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
20
+
21
+ # puppet
22
+ rpm -ivh http://yum.puppetlabs.com/el/5/products/i386/puppetlabs-release-5-6.noarch.rpm
23
+ yum -y install puppet-2.6.10
24
+
25
+ # chef, via gem
26
+ #yum install ruby ruby-devel ruby-ri ruby-rdoc ruby-shadow gcc gcc-c++ automake autoconf make curl dmidecode
27
+ #gem install chef --no-ri --no-rdoc
28
+
29
+ # chef, via rpms (I'm not sure how sane this is, it installs lots of rubygem-xxx packages)
30
+ rpm -Uvh http://rbel.co/rbel5
31
+ yum -y install rubygem-chef
32
+
33
+ # clean up yum meta data cache
34
+ yum -y clean all
35
+
36
+ #Installing vagrant keys
37
+ mkdir /home/vagrant/.ssh
38
+ chmod 700 /home/vagrant/.ssh
39
+ cd /home/vagrant/.ssh
40
+ wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
41
+ chown -R vagrant /home/vagrant/.ssh
42
+
43
+ #Installing the virtualbox guest additions
44
+ VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
45
+ cd /tmp
46
+ wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
47
+ mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
48
+ sh /mnt/VBoxLinuxAdditions.run
49
+ umount /mnt
50
+
51
+ rm VBoxGuestAdditions_$VBOX_VERSION.iso
52
+
53
+
54
+ sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
55
+ sed -i "s/^\(.*env_keep = \"\)/\1PATH /" /etc/sudoers
56
+
57
+ # Zero out the free space to save space in the final image:
58
+ dd if=/dev/zero of=/EMPTY bs=1M
59
+ rm -f /EMPTY
60
+
61
+ exit