Added building Ubuntu 20.04 template

This commit is contained in:
2024-09-22 20:13:32 +03:00
parent 36aa9106ea
commit 09aa511791
35 changed files with 629 additions and 123 deletions

View File

@ -1,7 +1,7 @@
vcenter_datacenter = "DC01"
vcenter_cluster = "Cluster01"
vcenter_host = "esxi8-01.lab.loc"
vcenter_folder = "VLAN-0221"
vcenter_folder = "z-Templates"
vcenter_datastore = "Cluster01-LUN02"
//vm_name = "z-ubuntu-packer-vm"

View File

@ -27,6 +27,7 @@ sudo echo "#!/bin/sh -e
#
# By default this script does nothing.
exit 0
" > /etc/rc.local

View File

@ -7,7 +7,7 @@ autoinstall:
identity:
hostname: ubuntu-24-04-auto-tmpl
username: ansb-srv-it
password: '$6$R789K/T7lS27KICW$2i5f/sP6nXniEMbjnTyswKMdStGVQdbz8jqIyrXxrhYxJLD0JrWTZjnlFpWkEOlJ2Oa9WvEcANu9iLY3mg5mw.'
password: '$6$5nLO9zRvoiQP7DdR$DYRibWnOQncB0qR9ugRSqAxWwVCPMfeRUBDdTuYxjh2FSZyRKtf57CG8ybGbFjVCAzJdcQg9qtJYhI.LhWhhe1'
storage:
config:
- {ptable: gpt, path: /dev/sda, wipe: superblock, preserve: false, name: '', grub_device: true, type: disk, id: disk-sda}
@ -36,6 +36,10 @@ autoinstall:
updates: all
packages:
- open-vm-tools
- ifupdown
- perl-modules-*
- net-tools
- util-linux-extra
- sudo
late-commands:
- echo 'ansb-srv-it ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ansb-srv-it

View File

@ -32,7 +32,7 @@ source "vsphere-iso" "ubuntu-24-04-x64" {
host = var.vcenter_host
datastore = var.vcenter_datastore
folder = var.vcenter_folder
# convert_to_template = true
convert_to_template = true
// ****************
vm_name = var.vm_name
CPUs = var.vm_num_cpu
@ -85,10 +85,10 @@ build {
]
}
// provisioner "shell-local" {
// inline = [
// "ansible-playbook ~/ansible/playbooks/os-linux-prep-default.yml -l packer-templ -e hosts_target=packer-templ -e ansible_host=${build.Host} -e connection_username=${var.connection_username} -e connection_ssh_private_key_file=${var.connection_ssh_private_key_file}"
// ]
// }
provisioner "shell-local" {
inline = [
"ansible-playbook ~/ansible/playbooks/os-linux-prep-templ.yml -l packer-templ-ubuntu-24-04-x64 -e hosts_target=packer-templ-ubuntu-24-04-x64 -e ansible_host=${build.Host} -e connection_username=${var.connection_username} -e connection_ssh_private_key_file=${var.connection_ssh_private_key_file}"
]
}
}