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