almost working
This commit is contained in:
parent
2664e72682
commit
989dd0a84e
|
@ -3,7 +3,7 @@ build {
|
|||
name = "alpine"
|
||||
description = <<EOF
|
||||
This build creates alpine images for versions :
|
||||
* v3.8
|
||||
* v3.12
|
||||
For the following builers :
|
||||
* virtualbox-iso
|
||||
EOF
|
||||
|
@ -12,11 +12,20 @@ EOF
|
|||
// source.builder-type.pkr.hcl files, here we only set the fields specific to
|
||||
// the different versions of ubuntu.
|
||||
source "source.virtualbox-iso.base-alpine-amd64" {
|
||||
name = "3.8"
|
||||
iso_url = local.iso_url_alpine_380
|
||||
iso_checksum = "file:${local.iso_checksum_url_alpine_380}"
|
||||
output_directory = "virtualbox_iso_alpine_380_amd64"
|
||||
boot_command = local.alpine_380_floppy_boot_command
|
||||
name = "3.12"
|
||||
iso_url = local.iso_url_alpine_312
|
||||
iso_checksum = "file:${local.iso_checksum_url_alpine_312}"
|
||||
output_directory = "virtualbox_iso_alpine_312_amd64"
|
||||
boot_command = local.alpine_312_floppy_boot_command
|
||||
boot_wait = "10s"
|
||||
}
|
||||
|
||||
source "source.vsphere-iso.base-alpine-amd64" {
|
||||
name = "3.12"
|
||||
vm_name = "alpine-3.12"
|
||||
iso_url = local.iso_url_alpine_312
|
||||
iso_checksum = "file:${local.iso_checksum_url_alpine_312}"
|
||||
boot_command = local.alpine_312_floppy_boot_command_vsphere
|
||||
boot_wait = "10s"
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ iface eth0 inet dhcp
|
|||
"
|
||||
TIMEZONEOPTS="-z UTC"
|
||||
PROXYOPTS="none"
|
||||
APKREPOSOPTS="http://mirror.yandex.ru/mirrors/alpine/v3.8/main"
|
||||
APKREPOSOPTS="http://mirrors.dotsrc.org/alpine/v3.8/main"
|
||||
SSHDOPTS="-c openssh"
|
||||
NTPOPTS="-c none"
|
||||
DISKOPTS="-m sys /dev/sda"
|
||||
|
|
|
@ -13,8 +13,6 @@ poweroff
|
|||
EOF
|
||||
chmod +x /usr/local/bin/shutdown
|
||||
|
||||
ifconfig eth0 up && udhcpc -i eth0
|
||||
|
||||
sed -i "/#PermitRootLogin/c\PermitRootLogin yes" /etc/ssh/sshd_config
|
||||
sed -i "/#PasswordAuthentication/c\PasswordAuthentication yes" /etc/ssh/sshd_config
|
||||
mkdir ~/.ssh
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
KEYMAPOPTS="us us"
|
||||
HOSTNAMEOPTS="-n alpine"
|
||||
INTERFACESOPTS="auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address 147.75.201.6
|
||||
netmask 255.255.255.248
|
||||
network 147.75.201.0
|
||||
broadcast 147.75.201.7
|
||||
gateway 147.75.201.1
|
||||
"
|
||||
DNSOPTS="-d example.com 8.8.8.8"
|
||||
TIMEZONEOPTS="-z UTC"
|
||||
PROXYOPTS="none"
|
||||
APKREPOSOPTS="http://dl-cdn.alpinelinux.org/alpine/v3.12/main
|
||||
http://dl-cdn.alpinelinux.org/alpine/v3.8/main
|
||||
"
|
||||
SSHDOPTS="-c openssh"
|
||||
NTPOPTS="-c none"
|
||||
DISKOPTS="-m sys /dev/sda"
|
|
@ -22,5 +22,5 @@ source "virtualbox-iso" "base-alpine-amd64" {
|
|||
ssh_password = var.alpine_password
|
||||
ssh_wait_timeout = "60m"
|
||||
shutdown_command = "poweroff"
|
||||
floppy_files = local.floppy_files
|
||||
floppy_files = local.floppy_files_alpine
|
||||
}
|
||||
|
|
|
@ -80,3 +80,36 @@ source "vsphere-iso" "base-ubuntu-amd64" {
|
|||
"<enter>"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
source "vsphere-iso" "base-alpine-amd64" {
|
||||
vcenter_server = var.vcenter_endpoint
|
||||
username = var.vcenter_user
|
||||
password = var.vcenter_password
|
||||
host = var.esxi_host
|
||||
insecure_connection = true
|
||||
|
||||
datacenter = var.datacenter_name
|
||||
datastore = "datastore1"
|
||||
|
||||
ssh_username = "root"
|
||||
ssh_password = var.alpine_password
|
||||
|
||||
CPUs = 1
|
||||
RAM = 512 * 2
|
||||
RAM_reserve_all = true
|
||||
|
||||
guest_os_type = "otherLinux64Guest"
|
||||
|
||||
floppy_files = local.floppy_files_alpine_vsphere
|
||||
|
||||
network_adapters {
|
||||
network = "VM Network"
|
||||
network_card = "vmxnet3"
|
||||
}
|
||||
|
||||
storage {
|
||||
disk_size = 32768
|
||||
disk_thin_provisioned = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,14 @@ variable "alpine_password" {
|
|||
}
|
||||
|
||||
locals {
|
||||
iso_url_alpine_380 = "http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/x86_64/alpine-standard-3.8.0-x86_64.iso"
|
||||
iso_checksum_url_alpine_380 = "http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/x86_64/alpine-standard-3.8.0-x86_64.iso.sha256"
|
||||
floppy_files = [
|
||||
iso_url_alpine_312 = "http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-virt-3.12.0-x86_64.iso"
|
||||
iso_checksum_url_alpine_312 = "http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-virt-3.12.0-x86_64.iso.sha256"
|
||||
floppy_files_alpine = [
|
||||
"${local.http_directory}/alpine-answers",
|
||||
"${local.http_directory}/alpine-setup.sh"
|
||||
]
|
||||
alpine_380_floppy_boot_command = [
|
||||
|
||||
alpine_312_floppy_boot_command = [
|
||||
"root<enter><wait>",
|
||||
"mount -t vfat /dev/fd0 /media/floppy<enter><wait>",
|
||||
"setup-alpine -f /media/floppy/alpine-answers<enter>",
|
||||
|
@ -29,4 +30,26 @@ locals {
|
|||
"/media/floppy/alpine-setup.sh<enter>",
|
||||
]
|
||||
|
||||
floppy_files_alpine_vsphere = [
|
||||
"${local.http_directory}/alpine-vsphere-answers",
|
||||
"${local.http_directory}/alpine-setup.sh"
|
||||
]
|
||||
|
||||
alpine_312_floppy_boot_command_vsphere = [
|
||||
"root<enter><wait1s>",
|
||||
"mount -t vfat /dev/fd0 /media/floppy<enter><wait1s>",
|
||||
"setup-alpine -f /media/floppy/alpine-vsphere-answers<enter><wait3s>",
|
||||
"${var.alpine_password}<enter>",
|
||||
"${var.alpine_password}<enter>",
|
||||
"<wait15s>",
|
||||
"y<enter>",
|
||||
"<wait15s>",
|
||||
"reboot<enter>",
|
||||
"<wait15s>",
|
||||
"root<enter>",
|
||||
"${var.alpine_password}<enter><wait>",
|
||||
"mount -t vfat /dev/fd0 /media/floppy<enter><wait>",
|
||||
"/media/floppy/alpine-setup.sh<enter>",
|
||||
]
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue