fixed template, still not working
This commit is contained in:
parent
6cb709bc3a
commit
83e2e8df1d
3 changed files with 118 additions and 1 deletions
5
build_rocky8.sh
Normal file
5
build_rocky8.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
packer build \
|
||||||
|
-var proxmox_node=hp-desktop \
|
||||||
|
-var proxmox_username="root@pam" \
|
||||||
|
-var proxmox_password=password \
|
||||||
|
-var proxmox_url=https://192.168.0.1:8006/api2/json \
|
||||||
|
|
@ -17,7 +17,7 @@ network --bootproto=dhcp --ipv6=auto --activate
|
||||||
network --hostname=localhost.localdomain
|
network --hostname=localhost.localdomain
|
||||||
repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
|
repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
|
||||||
# Root password
|
# Root password
|
||||||
rootpw Packer
|
rootpw $6$iURlXPBRzfcBcMll$kvHvSzFZK9NCauVwgJT.hpZF.0b4V4nqcb1Vj237QkP5JwgonFwrUwySCskth5T5hNjmsXqxuzlX.2G53eIc21 --iscrypted
|
||||||
# Run the Setup Agent on first boot
|
# Run the Setup Agent on first boot
|
||||||
firstboot --disabled
|
firstboot --disabled
|
||||||
# Do not configure the X Window System
|
# Do not configure the X Window System
|
||||||
|
|
|
||||||
112
rocky8/packer.json.pkr.hcl
Normal file
112
rocky8/packer.json.pkr.hcl
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
|
||||||
|
variable "centos_image" {
|
||||||
|
type = string
|
||||||
|
default = "Rocky-8.7-x86_64-dvd1.iso"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "proxmox_iso_pool" {
|
||||||
|
type = string
|
||||||
|
default = "vmdata1_nas_nfs:iso"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "proxmox_node" {
|
||||||
|
type = string
|
||||||
|
default = "pve1"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "proxmox_password" {
|
||||||
|
type = string
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "vm_password" {
|
||||||
|
type = string
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "proxmox_storage_format" {
|
||||||
|
type = string
|
||||||
|
default = "qcow2"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "proxmox_storage_pool" {
|
||||||
|
type = string
|
||||||
|
default = "vmdata1_nas_nfs"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "proxmox_storage_pool_type" {
|
||||||
|
type = string
|
||||||
|
default = "directory"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "proxmox_url" {
|
||||||
|
type = string
|
||||||
|
default = "https://192.168.1.51:8006/api2/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "proxmox_username" {
|
||||||
|
type = string
|
||||||
|
default = "root@pam"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "template_description" {
|
||||||
|
type = string
|
||||||
|
default = "Rocky Linux 8 Template"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "template_name" {
|
||||||
|
type = string
|
||||||
|
default = "RockyLinux8Template"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "version" {
|
||||||
|
type = string
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
source "proxmox" "autogenerated_1" {
|
||||||
|
boot_command = ["<tab> text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/inst.ks<enter><wait>"]
|
||||||
|
boot_wait = "10s"
|
||||||
|
cores = "2"
|
||||||
|
disks {
|
||||||
|
disk_size = "8G"
|
||||||
|
format = "${var.proxmox_storage_format}"
|
||||||
|
storage_pool = "${var.proxmox_storage_pool}"
|
||||||
|
storage_pool_type = "${var.proxmox_storage_pool_type}"
|
||||||
|
type = "scsi"
|
||||||
|
}
|
||||||
|
http_directory = "rocky8"
|
||||||
|
insecure_skip_tls_verify = true
|
||||||
|
iso_file = "${var.proxmox_iso_pool}/${var.centos_image}"
|
||||||
|
memory = "2048"
|
||||||
|
network_adapters {
|
||||||
|
bridge = "vmbr1"
|
||||||
|
vlan_tag = "20"
|
||||||
|
model = "virtio"
|
||||||
|
firewall = false
|
||||||
|
}
|
||||||
|
node = "${var.proxmox_node}"
|
||||||
|
os = "l26"
|
||||||
|
password = "${var.proxmox_password}"
|
||||||
|
proxmox_url = "${var.proxmox_url}"
|
||||||
|
scsi_controller = "virtio-scsi-single"
|
||||||
|
ssh_password = "${var.vm_password}"
|
||||||
|
ssh_port = 22
|
||||||
|
ssh_timeout = "30m"
|
||||||
|
ssh_username = "root"
|
||||||
|
template_description = "${var.template_description}"
|
||||||
|
template_name = "${var.template_name}"
|
||||||
|
unmount_iso = true
|
||||||
|
username = "${var.proxmox_username}"
|
||||||
|
vm_id = 517
|
||||||
|
}
|
||||||
|
|
||||||
|
build {
|
||||||
|
sources = ["source.proxmox.autogenerated_1"]
|
||||||
|
|
||||||
|
provisioner "shell" {
|
||||||
|
inline = ["yum install -y cloud-init qemu-guest-agent cloud-utils-growpart gdisk", "shred -u /etc/ssh/*_key /etc/ssh/*_key.pub", "rm -f /var/run/utmp", ">/var/log/lastlog", ">/var/log/wtmp", ">/var/log/btmp", "rm -rf /tmp/* /var/tmp/*", "unset HISTFILE; rm -rf /home/*/.*history /root/.*history", "rm -f /root/*ks", "passwd -d root", "passwd -l root"]
|
||||||
|
only = ["proxmox"]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue