moving forward
This commit is contained in:
@@ -1,21 +1,26 @@
|
||||
source "proxmox" "ubuntu" {
|
||||
source "proxmox-iso" "ubuntu" {
|
||||
template_name = "ubuntu"
|
||||
template_description = "Ubuntu Linux Server template"
|
||||
proxmox_url = "https://192.168.111.36:8006/api2/json"
|
||||
node = "n100noeud"
|
||||
iso_file = var.ISODISK
|
||||
iso_checksum = var.ISOHASH
|
||||
boot_iso {
|
||||
type = "scsi"
|
||||
iso_file = var.ISODISK
|
||||
unmount = true
|
||||
iso_checksum = var.ISOHASH
|
||||
}
|
||||
insecure_skip_tls_verify = true
|
||||
pool = "Linux-VM"
|
||||
vm_name = "PackerTest"
|
||||
# pool = "Linux-VM"
|
||||
vm_name = var.vm_name
|
||||
vm_id = 664
|
||||
memory = 2048
|
||||
cores = 1
|
||||
sockets = 2
|
||||
os = "l26"
|
||||
cpu_type = "host"
|
||||
http_port_min = 4990
|
||||
http_port_max = 4999
|
||||
http_directory = "redhat"
|
||||
http_directory = "ubuntu"
|
||||
username = "root@pam"
|
||||
password = "galeregalere"
|
||||
ssh_username = "root"
|
||||
@@ -33,68 +38,25 @@ source "proxmox" "ubuntu" {
|
||||
type = "scsi"
|
||||
disk_size = "55G"
|
||||
storage_pool = "FAST"
|
||||
storage_pool_type = "lvm-thin"
|
||||
format = "raw"
|
||||
format = "qcow2"
|
||||
}
|
||||
boot_wait = "5s"
|
||||
boot_command = ["<wait2><up><wait1><tab><wait1> inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/redhat.kix<wait1s><enter>"]
|
||||
}
|
||||
|
||||
source "proxmox" "centos" {
|
||||
template_name = "centos"
|
||||
template_description = "Rocky Linux Server template"
|
||||
proxmox_url = "https://192.168.111.36:8006/api2/json"
|
||||
node = "n100noeud"
|
||||
iso_file = var.ISODISK
|
||||
iso_checksum = "f8e3086f3cea0fb3fefb29937ab5ed9d19e767079633960ccb50e76153effc98"
|
||||
insecure_skip_tls_verify = true
|
||||
pool = "Linux-VM"
|
||||
vm_name = "PackerTest"
|
||||
vm_id = 664
|
||||
memory = 2048
|
||||
cores = 1
|
||||
sockets = 2
|
||||
os = "l26"
|
||||
http_port_min = 4990
|
||||
http_port_max = 4999
|
||||
http_directory = "redhat"
|
||||
username = "root@pam"
|
||||
password = "galeregalere"
|
||||
ssh_username = "root"
|
||||
ssh_password = "M0ukreneIsVeryGood!"
|
||||
ssh_timeout = "15m"
|
||||
network_adapters {
|
||||
model = "virtio"
|
||||
bridge = "vmbr111"
|
||||
}
|
||||
|
||||
qemu_agent = true
|
||||
scsi_controller = "virtio-scsi-pci"
|
||||
|
||||
disks {
|
||||
type = "scsi"
|
||||
disk_size = "55G"
|
||||
storage_pool = "FAST"
|
||||
storage_pool_type = "lvm-thin"
|
||||
format = "raw"
|
||||
}
|
||||
boot_wait = "5s"
|
||||
boot_command = ["<wait2><up><wait1><tab><wait1> inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/redhat.kix<wait1s><enter>"]
|
||||
boot_command = var.BOOT_COMMAND
|
||||
}
|
||||
|
||||
build {
|
||||
sources = [ "source.proxmox.centos" ]
|
||||
sources = [ "source.proxmox-iso.ubuntu" ]
|
||||
|
||||
provisioner "ansible" {
|
||||
pause_before = "20s"
|
||||
ansible_env_vars= [
|
||||
"ANSIBLE_HOST_KEY_CHECKING=False",
|
||||
"ANSIBLE_SSH_ARGS='-o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s'",
|
||||
"ANSIBLE_NOCOLOR=True"
|
||||
]
|
||||
extra_arguments= [
|
||||
"-e templating=true"
|
||||
]
|
||||
playbook_file = "../../../Ansible/playbooks/MyLinuxServers.yaml"
|
||||
}
|
||||
# provisioner "ansible" {
|
||||
# pause_before = "20s"
|
||||
# ansible_env_vars= [
|
||||
# "ANSIBLE_HOST_KEY_CHECKING=False",
|
||||
# "ANSIBLE_SSH_ARGS='-o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s'",
|
||||
# "ANSIBLE_NOCOLOR=True"
|
||||
# ]
|
||||
# extra_arguments= [
|
||||
# "-e templating=true"
|
||||
# ]
|
||||
# playbook_file = "../../../Ansible/playbooks/MyLinuxServers.yaml"
|
||||
# }
|
||||
}
|
||||
@@ -2,21 +2,13 @@
|
||||
packer {
|
||||
required_version = ">= 1.7.4"
|
||||
required_plugins {
|
||||
windows-update = {
|
||||
version = "0.14.0"
|
||||
source = "github.com/rgl/windows-update"
|
||||
}
|
||||
amazon = {
|
||||
source = "github.com/hashicorp/amazon"
|
||||
version = "~> 1"
|
||||
}
|
||||
ansible = {
|
||||
source = "github.com/hashicorp/ansible"
|
||||
version = "~> 1"
|
||||
}
|
||||
vsphere = {
|
||||
source = "github.com/hashicorp/vsphere"
|
||||
proxmox = {
|
||||
version = "~> 1"
|
||||
source = "github.com/hashicorp/proxmox"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,29 +16,29 @@ packer {
|
||||
# Variables definition
|
||||
variable "SCSI_Controller" {
|
||||
type = string
|
||||
default = "pvscsi"
|
||||
}
|
||||
|
||||
variable "packer_svr_addr" {
|
||||
type = string
|
||||
default = "127.0.0.1"
|
||||
}
|
||||
|
||||
|
||||
variable "VMNAME" {
|
||||
variable "vm_name" {
|
||||
type = string
|
||||
default = "BMaster-Template"
|
||||
}
|
||||
|
||||
|
||||
variable "ISODISK" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "BOOT_COMMAND" {
|
||||
variable "ISOHASH" {
|
||||
type = string
|
||||
default = "lets boot"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "BOOT_COMMAND" {
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "kickstart_path" {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
iso_file = "local:ISOS/ubuntu-24.04.1-live-server-amd64.iso"
|
||||
iso_checksum = "e240e4b801f7bb68c20d1356b60968ad0c33a41d00d828e74ceb3364a0317be9"
|
||||
ISODISK = "local:ISOS/ubuntu-24.04.1-live-server-amd64.iso"
|
||||
ISOHASH = "sha256:e240e4b801f7bb68c20d1356b60968ad0c33a41d00d828e74ceb3364a0317be9"
|
||||
vm_name = "VM-UBU_2404"
|
||||
vm_id = 654
|
||||
|
||||
BOOT_COMMAND = ["<enter><wait2><enter><wait2><f6><esc><wait2> ", "autoinstall ds=nocloud-net;seedfrom=http://{{ .HTTPIP }}:{{ .HTTPPort }}/", "<wait><enter>"]
|
||||
@@ -6,7 +6,7 @@ ICPREFIX="ICVM"
|
||||
PACKER_LOG=1
|
||||
SCRIPTDIR=$(dirname $0)
|
||||
#DFT_PARAM="-force -color=false -on-error=ask -var-file ${SCRIPTDIR}/config/irisvars.json"
|
||||
DFT_PARAM="-force -color=false -var-file ${SCRIPTDIR}/config/irisvars.json"
|
||||
DFT_PARAM="-force -color=false"
|
||||
OSString=$1
|
||||
case $1 in
|
||||
ROCKY9)
|
||||
@@ -15,27 +15,27 @@ case $1 in
|
||||
TheBuilder="proxmox.centos"
|
||||
VMNAME=${THEPREFIX}-${OSSTRING}-${THE_VER}
|
||||
BuildSettings="${DFT_PARAM} -only=${TheBuilder} \
|
||||
-var VMNAME=${VMNAME} \
|
||||
-var vm_name=${VMNAME} \
|
||||
-var-file=${OSSTRING}.pkrvars.hcl \
|
||||
${SCRIPTDIR}/Linux"
|
||||
;;
|
||||
UBUNTU2004)
|
||||
OSSTRING="Ubuntu2004"
|
||||
THEPREFIX="linux"
|
||||
TheBuilder="proxmox.ubuntu"
|
||||
TheBuilder="proxmox-iso.ubuntu"
|
||||
VMNAME=${THEPREFIX}-${OSSTRING}-${THE_VER}
|
||||
BuildSettings="${DFT_PARAM} -only=${TheBuilder} \
|
||||
-var VMNAME=${VMNAME} \
|
||||
-var vm_name=${VMNAME} \
|
||||
-var-file=${OSSTRING}.pkrvars.hcl \
|
||||
${SCRIPTDIR}/Linux"
|
||||
;;
|
||||
UBUNTU2404)
|
||||
OSSTRING="Ubuntu2404"
|
||||
THEPREFIX="linux"
|
||||
TheBuilder="proxmox.ubuntu"
|
||||
TheBuilder="proxmox-iso.ubuntu"
|
||||
VMNAME=${THEPREFIX}-${OSSTRING}-${THE_VER}
|
||||
BuildSettings="${DFT_PARAM} -only=${TheBuilder} \
|
||||
-var VMNAME=${VMNAME} \
|
||||
-var vm_name=${VMNAME} \
|
||||
-var-file=${OSSTRING}.pkrvars.hcl \
|
||||
-var-file=Common.pkrvars.hcl \
|
||||
${SCRIPTDIR}/Linux"
|
||||
@@ -52,7 +52,6 @@ echo lets build $1
|
||||
#echo "BuildSettings: ${BuildSettings}"
|
||||
#echo "packer build ${BuildSettings}"
|
||||
#echo "ISODISK ${ISODISK}"
|
||||
. $HOME/packer.sh
|
||||
time packer build ${BuildSettings} | tee $1.log
|
||||
#packer build ${BuildSettings} | tee $1.log
|
||||
echo "exit code:$?"
|
||||
|
||||
Reference in New Issue
Block a user