Added building Ubuntu 20.04 template
This commit is contained in:
@ -9,5 +9,5 @@ For secrets and cred vars create $HOME/.secret/.packer/vcsrv-creds.pkrvars.hcl<b
|
||||
|
||||
`connection_username = "root"`<br/>
|
||||
`connection_password = "XXXXXXXX"`<br/>
|
||||
`ssh_private_key_file = "/root/.ssh/XXXXXXX_ansible"`<br/>
|
||||
`ssh_private_key_file = "~/.ssh/XXXXXXX_ansible"`<br/>
|
||||
<br/>
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
packer="/usr/bin/packer"
|
||||
|
||||
vm_name="x-debian-packer-vm"
|
||||
vm_name="x-debian12-packer-vm"
|
||||
|
||||
# => For logs:
|
||||
#export PACKER_LOG_PATH=./build-debian-12-amd64.log
|
||||
#export PACKER_LOG_PATH=./build-debian-12-x64.log
|
||||
export PACKER_LOG=0
|
||||
|
||||
creds_vars_file="$HOME/.secret/.packer/vcsrv-creds.pkrvars.hcl"
|
||||
|
5
packer/linux/build-ubuntu-24.04-x64.sh
Normal file → Executable file
5
packer/linux/build-ubuntu-24.04-x64.sh
Normal file → Executable file
@ -2,10 +2,10 @@
|
||||
|
||||
packer="/usr/bin/packer"
|
||||
|
||||
vm_name="x-ubuntu-packer-vm"
|
||||
vm_name="x-ubuntu24-packer-vm"
|
||||
|
||||
# => For logs:
|
||||
#export PACKER_LOG_PATH=./build-debian-12-amd64.log
|
||||
#export PACKER_LOG_PATH=./build-ubuntu-24.04-x64.log
|
||||
export PACKER_LOG=0
|
||||
|
||||
creds_vars_file="$HOME/.secret/.packer/vcsrv-creds.pkrvars.hcl"
|
||||
@ -17,4 +17,3 @@ $packer build -force \
|
||||
-var-file="$HOME/packer/linux/ubuntu-24.04-x64/conf.pkrvars.hcl" \
|
||||
-var vm_name=$vm_name \
|
||||
$HOME/packer/linux/ubuntu-24.04-x64/
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
vcenter_datacenter = "DC01"
|
||||
vcenter_cluster = "Cluster01"
|
||||
vcenter_host = "esxi8-01.lab.loc"
|
||||
vcenter_folder = "VLAN-0221"
|
||||
vcenter_host = "esxi8-02.lab.loc"
|
||||
vcenter_folder = "z-Templates"
|
||||
vcenter_datastore = "Cluster01-LUN02"
|
||||
|
||||
//vm_name = "z-debian-packer-vm"
|
||||
|
@ -27,6 +27,7 @@ sudo echo "#!/bin/sh -e
|
||||
#
|
||||
# By default this script does nothing.
|
||||
|
||||
|
||||
exit 0
|
||||
" > /etc/rc.local
|
||||
|
||||
|
@ -87,7 +87,7 @@ 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}"
|
||||
"ansible-playbook ~/ansible/playbooks/os-linux-prep-templ.yml -l packer-templ-debian-12-x64 -e hosts_target=packer-templ-debian-12-x64 -e ansible_host=${build.Host} -e connection_username=${var.connection_username} -e connection_ssh_private_key_file=${var.connection_ssh_private_key_file}"
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -85,12 +85,12 @@ d-i partman/mount_style select uuid
|
||||
# mkpasswd -s -m sha-512
|
||||
#
|
||||
d-i passwd/root-login boolean true
|
||||
d-i passwd/root-password-crypted password $6$Lij5f1fxeWVCjFbJ$GiWa3/zslkXwE4OfHeQrx/AlDPqhZR9pxSMxAvEZX8twF8ti7L6KM8wQWARzH.nQ99/BEmrjfDM/hwuczDJxY1
|
||||
d-i passwd/root-password-crypted password $6$5nLO9zRvoiQP7DdR$DYRibWnOQncB0qR9ugRSqAxWwVCPMfeRUBDdTuYxjh2FSZyRKtf57CG8ybGbFjVCAzJdcQg9qtJYhI.LhWhhe1
|
||||
# Create [ ansb-srv-it ] user account.
|
||||
d-i passwd/make-user boolean true
|
||||
d-i passwd/user-fullname string ansb-srv-it
|
||||
d-i passwd/username string ansb-srv-it
|
||||
d-i passwd/user-password-crypted password $6$Lij5f1fxeWVCjFbJ$GiWa3/zslkXwE4OfHeQrx/AlDPqhZR9pxSMxAvEZX8twF8ti7L6KM8wQWARzH.nQ99/BEmrjfDM/hwuczDJxY1
|
||||
d-i passwd/user-password-crypted password $6$5nLO9zRvoiQP7DdR$DYRibWnOQncB0qR9ugRSqAxWwVCPMfeRUBDdTuYxjh2FSZyRKtf57CG8ybGbFjVCAzJdcQg9qtJYhI.LhWhhe1
|
||||
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
|
@ -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"
|
||||
|
@ -27,6 +27,7 @@ sudo echo "#!/bin/sh -e
|
||||
#
|
||||
# By default this script does nothing.
|
||||
|
||||
|
||||
exit 0
|
||||
" > /etc/rc.local
|
||||
|
||||
|
@ -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
|
||||
|
@ -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}"
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user