Skip to content

Commit

Permalink
Homework dmitry-lyutenko#1: Create Vagrant box
Browse files Browse the repository at this point in the history
  • Loading branch information
incertov committed May 6, 2020
1 parent 7b36bf8 commit ed3ebcb
Show file tree
Hide file tree
Showing 20 changed files with 198 additions and 0 deletions.
1 change: 1 addition & 0 deletions .vagrant/machines/kernel-update/virtualbox/vagrant_cwd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/mnt/BC4017954017558C/EDU2020/git/manual_kernel_update
9 changes: 9 additions & 0 deletions .vagrant/rgloader/loader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.

if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5:650ae23f-0f18-4f8d-be56-2e5cbbdbc683
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1588689466
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"centos/7","version":"1905.1","provider":"virtualbox","directory":"boxes/centos-VAGRANTSLASH-7/1905.1/virtualbox"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
650ae23f-0f18-4f8d-be56-2e5cbbdbc683
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eb3c25752e29486aba3b627137f9b5ed
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAs4ZKJKZ1ANb2V5ixxNZgFaIxd3TTULaEVBetxteOA6iQTHOw
QkAVR2wynoGW76YrNQRFrCl0F++r3qi7GFj7axDzLUbZJIDugv0FWTRlwZ48e5v8
zPGaWHLF4T1AnNgejYejI0ifFCfgRT7R/oxgA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gleFYkMmXWXgaGTX3KcCgYBP4G+8X0ajt/dgjT4oWsdwA9SWSnbOZFXOeP1l
Mot95AMZlz7a7ONwRiqlNZeUyRk+2OuZMd4vB87lqbusWAXTNpALejbBpGO2vyes
+LAST2iQO1/SNSjsoI4+klNKzgHGCXsl4MlRyCPTskPc6N0mM80LEYYQW5BhoETu
/3VRUQKBgQC/LvSzNrL7m5paIe/H9uEFSvfKEx0Q+s0u6bzGsT4JG2wdmEbJ7ms9
h3lyDuqseKJiEeqZ0FX1AizH2cU29fP4hDCSOvNeby/QHD8Vq6ENqQ8EK48vOVTs
CN+cKbBg6JL5V/vdkYIoEgBKrCsKWgCyYekePlnh24D2xb9nBWIQlg==
-----END RSA PRIVATE KEY-----
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/mnt/BC4017954017558C/EDU2020/git/manual_kernel_update/kernel_compilation_5.4
9 changes: 9 additions & 0 deletions kernel_compilation_5.4/.vagrant/rgloader/loader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.

if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end
51 changes: 51 additions & 0 deletions kernel_compilation_5.4/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Describe VMs
MACHINES = {
# VM name "kernel_compilation_5.4"
:"kernel-compilation" => {
# VM box
:box_name => "centos/7",
# VM CPU count
:cpus => 6,
# VM RAM size (Mb)
:memory => 2048,
# forwarded ports
:forwarded_port => []
#:forwarded_port => [guest: 22, host: 2200, protocol: "tcp"]
}
}

Vagrant.configure("2") do |config|
MACHINES.each do |boxname, boxconfig|
# Disable shared folders
config.vm.synced_folder ".", "/vagrant", disabled: true
# Disable audio
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--audio", "none"]
end
# Apply VM config
config.vm.define boxname do |box|
# Set VM base box and hostname
box.vm.box = boxconfig[:box_name]
box.vm.host_name = boxname.to_s
# Additional network config if present
#config.vm.network "private_network", adapter: 2, ip: '10.10.10.2', netmask: "255.255.255.0"
#config.vm.network "public_network", adapter: 3, type: "dhcp", bridge: "enp3s0"
# default router
#config.vm.provision "shell",
# run: "always",
# inline: "route add default gw 192.168.88.1"
# Port-forward config if present
if boxconfig.key?(:forwarded_port)
boxconfig[:forwarded_port].each do |port|
box.vm.network "forwarded_port", port
end
end
# VM resources config
box.vm.provider "virtualbox" do |v|
# Set VM RAM size and CPU count
v.memory = boxconfig[:memory]
v.cpus = boxconfig[:cpus]
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1588701177
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1000
1 change: 1 addition & 0 deletions packer/.vagrant/machines/kernel-update/virtualbox/id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dd284caf-8404-4051-80ce-9b6507dd173a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3aca5be2bce24606842ec229531688ef
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/mnt/BC4017954017558C/EDU2020/git/manual_kernel_update/packer
9 changes: 9 additions & 0 deletions packer/.vagrant/rgloader/loader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.

if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end
79 changes: 79 additions & 0 deletions packer/centos-mc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"variables": {
"artifact_description": "CentOS 7.7 with kernel 5.4.38-1",
"artifact_version": "7.7.1908",
"image_name": "centos-7.7"
},

"builders": [
{
"name": "{{user `image_name`}}",
"type": "virtualbox-iso",
"vm_name": "packer-centos-vm",

"boot_wait": "10s",
"disk_size": "10240",
"guest_os_type": "RedHat_64",
"http_directory": "http",

"iso_url": "http://mirror.yandex.ru/centos/7.7.1908/isos/x86_64/CentOS-7-x86_64-Minimal-1908.iso",
"iso_checksum": "9a2c47d97b9975452f7d582264e9fc16d108ed8252ac6816239a3b58cef5c53d",
"iso_checksum_type": "sha256",

"boot_command": [
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/vagrant.ks<enter><wait>"
],

"shutdown_command": "sudo -S /sbin/halt -h -p",
"shutdown_timeout" : "5m",

"ssh_wait_timeout": "20m",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_pty": true,

"output_directory": "builds",

"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--memory", "1024" ],
[ "modifyvm", "{{.Name}}", "--cpus", "2" ]
],

"export_opts":
[
"--manifest",
"--vsys", "0",
"--description", "{{user `artifact_description`}}",
"--version", "{{user `artifact_version`}}"
]

}
],

"post-processors": [
{
"output": "centos-{{user `artifact_version`}}-5.4.38-1-x86_64-Minimal.box",
"compression_level": "7",
"type": "vagrant"
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "{{.Vars}} sudo -S -E bash '{{.Path}}'",
"start_retry_timeout": "1m",
"expect_disconnect": true,
"pause_before": "20s",
"override": {
"{{user `image_name`}}" : {
"scripts" :
[
"scripts/stage-1-mc_kernel-update.sh",
"scripts/stage-2-clean.sh"
]
}
}
}
]
}

0 comments on commit ed3ebcb

Please sign in to comment.