Added MSVSphere 8 support

pull/4/head
Arkady L. Shane 9 months ago
parent daf213cac8
commit dcbc398e81
Signed by: tigro
GPG Key ID: 1EC08A25C9DB2503

@ -0,0 +1,53 @@
# AlmaLinux 8 kickstart file for Generic Cloud (OpenStack) image
url --url https://rsync.inferitos.ru/msvsphere/8/BaseOS/x86_64/kickstart/
repo --name=BaseOS --baseurl=https://rsync.inferitos.ru/msvsphere/8/BaseOS/x86_64/os/
repo --name=AppStream --baseurl=https://rsync.inferitos.ru/msvsphere/8/AppStream/x86_64/os/
text
skipx
eula --agreed
firstboot --disabled
lang en_US.UTF-8
keyboard us
timezone UTC --isUtc
network --bootproto=dhcp
firewall --enabled --service=ssh
services --disabled="kdump" --enabled="chronyd,rsyslog,sshd"
selinux --enforcing
# TODO: remove "console=tty0" from here
bootloader --append="console=ttyS0,115200n8 console=tty0 crashkernel=auto net.ifnames=0 no_timer_check" --location=mbr --timeout=1
zerombr
clearpart --all --initlabel
reqpart
part / --fstype="xfs" --size=8000
rootpw --plaintext msvsphere
reboot --eject
%packages
@core
-biosdevname
-open-vm-tools
-plymouth
-dnf-plugin-spacewalk
-rhn*
-iprutils
-iwl*-firmware
sphere-release-identity-server
sphere-release-server
sphere-release
%end
# disable kdump service
%addon com_redhat_kdump --disable
%end
%post
%end

@ -0,0 +1,57 @@
# MSVSphere 8 Vagrant boxes kickstart file
# TODO: change url to the kickstart one when we have it
url --url https://rsync.inferitos.ru/msvsphere/8/BaseOS/x86_64/kickstart/
repo --name=BaseOS --baseurl=https://rsync.inferitos.ru/msvsphere/8/BaseOS/x86_64/os/
repo --name=AppStream --baseurl=https://rsync.inferitos.ru/msvsphere/8/AppStream/x86_64/os/
text
skipx
eula --agreed
firstboot --disabled
lang en_US.UTF-8
keyboard us
timezone UTC --isUtc
network --bootproto=dhcp
firewall --disabled
services --enabled=sshd
selinux --enforcing
bootloader --location=mbr
zerombr
clearpart --all --initlabel
autopart --type=plain --nohome --noboot --noswap
rootpw vagrant
user --name=vagrant --plaintext --password vagrant
reboot --eject
%packages --ignoremissing --excludedocs --instLangs=en_US.UTF-8
bzip2
tar
-microcode_ctl
-iwl*-firmware
sphere-release-identity-server
sphere-release-server
sphere-release
%end
# disable kdump service
%addon com_redhat_kdump --disable
%end
%post
# allow passwordless sudo for the vagrant user
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
# see Vagrant documentation (https://docs.vagrantup.com/v2/boxes/base.html)
# for details about the requiretty.
sed -i "s/^.*requiretty/# Defaults requiretty/" /etc/sudoers
yum clean all
%end

@ -0,0 +1,54 @@
/*
* MSVSphere OS 8 Packer template for building Generic Cloud (OpenStack compatible) images.
*/
source "qemu" "msvsphere-8-gencloud-x86_64" {
iso_url = var.iso_url_8_x86_64
iso_checksum = var.iso_checksum_8_x86_64
shutdown_command = var.root_shutdown_command
accelerator = "kvm"
http_directory = var.http_directory
ssh_username = var.gencloud_ssh_username
ssh_password = var.gencloud_ssh_password
ssh_timeout = var.ssh_timeout
vnc_bind_address = var.vnc_bind_address
vnc_port_min = var.vnc_port_min
vnc_port_max = var.vnc_port_max
cpus = var.cpus
efi_firmware_code = var.uefi_ovmf_code
efi_firmware_vars = var.uefi_ovmf_vars
disk_interface = "virtio-scsi"
disk_size = var.gencloud_disk_size
disk_cache = "unsafe"
disk_discard = "unmap"
disk_detect_zeroes = "unmap"
disk_compression = true
format = "qcow2"
headless = var.headless
machine_type = "q35"
memory = var.memory
net_device = "virtio-net"
qemu_binary = var.qemu_binary
vm_name = "MSVSphere-${var.os_version_8}-${formatdate("YYYYMMDD", timestamp())}.gencloud.x86_64.qcow2"
boot_wait = var.boot_wait
boot_command = var.gencloud_boot_cmd_8_x86_64_uefi
}
build {
sources = [
"qemu.msvsphere-8-gencloud-x86_64"
]
provisioner "ansible" {
playbook_file = "ansible/gencloud.yml"
galaxy_file = "ansible/requirements.yml"
roles_path = "ansible/roles"
collections_path = "ansible/collections"
ansible_env_vars = [
"ANSIBLE_PIPELINING=True",
"ANSIBLE_REMOTE_TEMP=/tmp",
"ANSIBLE_SSH_ARGS='-o ControlMaster=no -o ControlPersist=180s -o ServerAliveInterval=120s -o TCPKeepAlive=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa'"
]
extra_arguments = ["--scp-extra-args", "'-O'"]
}
}

@ -0,0 +1,85 @@
/**
* Packer template for building MSVSphere 8 Vagrant boxes.
*/
source "virtualbox-iso" "msvsphere-8-vagrant-x86_64" {
iso_url = var.iso_url_8_x86_64
iso_checksum = var.iso_checksum_8_x86_64
boot_command = var.vagrant_boot_cmd_8_x86_64_bios
boot_wait = var.boot_wait
cpus = var.cpus
memory = var.memory
disk_size = var.vagrant_disk_size
headless = var.headless
http_directory = var.http_directory
guest_os_type = "RedHat_64"
shutdown_command = var.vagrant_shutdown_command
ssh_username = var.vagrant_ssh_username
ssh_password = var.vagrant_ssh_password
ssh_timeout = var.ssh_timeout
hard_drive_interface = "sata"
iso_interface = "sata"
vboxmanage = [
["modifyvm", "{{.Name}}", "--nat-localhostreachable1", "on"],
]
vboxmanage_post = [
["modifyvm", "{{.Name}}", "--memory", var.post_memory],
["modifyvm", "{{.Name}}", "--cpus", var.post_cpus]
]
}
source "vmware-iso" "msvsphere-8-vagrant-x86_64" {
iso_url = var.iso_url_8_x86_64
iso_checksum = var.iso_checksum_8_x86_64
boot_command = var.vagrant_boot_cmd_8_x86_64_bios
boot_wait = var.boot_wait
cpus = var.cpus
memory = var.memory
disk_size = var.vagrant_disk_size
headless = var.headless
http_directory = var.http_directory
guest_os_type = "centos-64"
shutdown_command = var.vagrant_shutdown_command
ssh_username = var.vagrant_ssh_username
ssh_password = var.vagrant_ssh_password
ssh_timeout = var.ssh_timeout
vmx_data = {
"cpuid.coresPerSocket" : "1"
}
vmx_data_post = {
"memsize" : var.post_memory
"numvcpus" : var.post_cpus
}
vmx_remove_ethernet_interfaces = true
}
build {
sources = [
"sources.virtualbox-iso.msvsphere-8-vagrant-x86_64",
"sources.vmware-iso.msvsphere-8-vagrant-x86_64"
]
provisioner "ansible" {
playbook_file = "ansible/vagrant.yml"
galaxy_file = "ansible/requirements.yml"
roles_path = "ansible/roles"
collections_path = "ansible/collections"
ansible_env_vars = [
"ANSIBLE_PIPELINING=True",
"ANSIBLE_REMOTE_TEMP=/tmp",
"ANSIBLE_SSH_ARGS='-o ControlMaster=no -o ControlPersist=180s -o ServerAliveInterval=120s -o TCPKeepAlive=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa'"
]
extra_arguments = [
"--extra-vars",
"packer_provider=${source.type}"
]
}
post-processors {
post-processor "vagrant" {
compression_level = "8"
output = "MSVSphere-${var.os_version_8}-${formatdate("YYYYMMDD", timestamp())}.{{.Provider}}.x86_64.box"
}
}
}

@ -0,0 +1,54 @@
/*
* MSVSphere OS 8 Packer template for building Generic Cloud (OpenStack compatible) images.
*/
source "qemu" "msvsphere-8-yandexcloud-x86_64" {
iso_url = var.iso_url_8_x86_64
iso_checksum = var.iso_checksum_8_x86_64
shutdown_command = var.root_shutdown_command
accelerator = "kvm"
http_directory = var.http_directory
ssh_username = var.gencloud_ssh_username
ssh_password = var.gencloud_ssh_password
ssh_timeout = var.ssh_timeout
vnc_bind_address = var.vnc_bind_address
vnc_port_min = var.vnc_port_min
vnc_port_max = var.vnc_port_max
cpus = var.cpus
efi_firmware_code = var.uefi_ovmf_code
efi_firmware_vars = var.uefi_ovmf_vars
disk_interface = "virtio-scsi"
disk_size = var.gencloud_disk_size
disk_cache = "unsafe"
disk_discard = "unmap"
disk_detect_zeroes = "unmap"
disk_compression = true
format = "qcow2"
headless = var.headless
machine_type = "q35"
memory = var.memory
net_device = "virtio-net"
qemu_binary = var.qemu_binary
vm_name = "MSVSphere-${var.os_version_8}-${formatdate("YYYYMMDD", timestamp())}.yandexcloud.x86_64.qcow2"
boot_wait = var.boot_wait
boot_command = var.gencloud_boot_cmd_8_x86_64_uefi
}
build {
sources = [
"qemu.msvsphere-8-yandexcloud-x86_64"
]
provisioner "ansible" {
playbook_file = "ansible/yandexcloud.yml"
galaxy_file = "ansible/requirements.yml"
roles_path = "ansible/roles"
collections_path = "ansible/collections"
ansible_env_vars = [
"ANSIBLE_PIPELINING=True",
"ANSIBLE_REMOTE_TEMP=/tmp",
"ANSIBLE_SSH_ARGS='-o ControlMaster=no -o ControlPersist=180s -o ServerAliveInterval=120s -o TCPKeepAlive=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa'"
]
extra_arguments = ["--scp-extra-args", "'-O'"]
}
}

@ -8,6 +8,12 @@ variable "os_version_9" {
default = "9.3" default = "9.3"
} }
variable "os_version_8" {
description = "The target MSVSphere 8 version"
type = string
default = "8.9"
}
// TODO: switch to the boot ISO on production // TODO: switch to the boot ISO on production
variable "iso_url_9_x86_64" { variable "iso_url_9_x86_64" {
description = "MSVSphere 9 x86_64 installation ISO URL" description = "MSVSphere 9 x86_64 installation ISO URL"
@ -15,12 +21,24 @@ variable "iso_url_9_x86_64" {
default = "https://repo1.msvsphere-os.ru/msvsphere/9/isos/x86_64/MSVSphere-9.3-x86_64-netinstall.iso" default = "https://repo1.msvsphere-os.ru/msvsphere/9/isos/x86_64/MSVSphere-9.3-x86_64-netinstall.iso"
} }
variable "iso_url_8_x86_64" {
description = "MSVSphere 8 x86_64 installation ISO URL"
type = string
default = "https://rsync.inferitos.ru/msvsphere/8/isos/x86_64/MSVSphere-8.9-x86_64-netinstall.iso"
}
variable "iso_checksum_9_x86_64" { variable "iso_checksum_9_x86_64" {
description = "MSVSphere 9 x86_64 installation ISO checksum" description = "MSVSphere 9 x86_64 installation ISO checksum"
type = string type = string
default = "file:https://repo1.msvsphere-os.ru/msvsphere/9/isos/x86_64/MSVSphere-9.3-x86_64-netinstall.iso.CHECKSUM" default = "file:https://repo1.msvsphere-os.ru/msvsphere/9/isos/x86_64/MSVSphere-9.3-x86_64-netinstall.iso.CHECKSUM"
} }
variable "iso_checksum_8_x86_64" {
description = "MSVSphere 8 x86_64 installation ISO checksum"
type = string
default = "file:https://rsync.inferitos.ru/msvsphere/8/isos/x86_64/MSVSphere-8.9-x86_64-netinstall.iso.CHECKSUM"
}
variable "headless" { variable "headless" {
description = "Start the VM without a GUI console if true" description = "Start the VM without a GUI console if true"
type = bool type = bool
@ -115,6 +133,16 @@ variable "vagrant_boot_cmd_9_x86_64_bios" {
] ]
} }
variable "vagrant_boot_cmd_8_x86_64_bios" {
description = "The boot command for x86_64 VMs in a BIOS mode"
type = list(string)
default = [
"<tab> inst.text inst.gpt ",
"inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/msvsphere-8-vagrant.x86_64.ks",
"<enter><wait>"
]
}
variable "vagrant_ssh_username" { variable "vagrant_ssh_username" {
description = "A login to use for SSH authentication" description = "A login to use for SSH authentication"
type = string type = string
@ -177,6 +205,23 @@ variable "gencloud_boot_cmd_9_x86_64_uefi" {
] ]
} }
variable "gencloud_boot_cmd_8_x86_64_uefi" {
description = "The boot command for x86_64 VMs in UEFI mode"
type = list(string)
default = [
"c<wait>",
"linuxefi",
" /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=MSVSphere-8-9-BaseOS-x86_64 ro",
" inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/msvsphere-8-gencloud.x86_64.ks",
"<enter>",
"initrdefi /images/pxeboot/initrd.img",
"<enter>",
"boot<enter><wait>"
]
}
variable "gencloud_ssh_username" { variable "gencloud_ssh_username" {
description = "A login to use for SSH authentication" description = "A login to use for SSH authentication"
type = string type = string

Loading…
Cancel
Save