moving forward

This commit is contained in:
2024-10-26 12:37:21 +02:00
parent e154cccee8
commit dfd3ad0022
4 changed files with 44 additions and 90 deletions

View File

@@ -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"
# }
}

View File

@@ -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" {