Finished packer scripts for Ubuntu 24.04

This commit is contained in:
2024-09-20 20:27:10 +03:00
parent 2c2770b4e1
commit f1c2906b58
13 changed files with 279 additions and 12 deletions

View File

@ -4,7 +4,7 @@ vcenter_host = "esxi8-01.lab.loc"
vcenter_folder = "VLAN-0221"
vcenter_datastore = "Cluster01-LUN02"
vm_name = "z-test-packer-vm"
vm_name = "z-debian-packer-vm"
vm_num_cpu = 1
vm_ram = 1024
vm_hardware_version = "20"

View File

@ -1,12 +1,12 @@
#!/bin/bash
echo Resize root partition...
echo "Resize root partition..."
sudo parted /dev/sda resizepart 2 100% > /dev/null 2>&1
sudo pvresize /dev/sda2 > /dev/null 2>&1
sudo lvextend -y -f -l +100%FREE /dev/vg01/root > /dev/null 2>&1
sudo resize2fs /dev/vg01/root > /dev/null 2>&1
echo Create rc.local file...
echo "Create rc.local file..."
sudo echo "#!/bin/sh -e
#
# rc.local

View File

@ -22,7 +22,7 @@ packer {
// var1 = "var1"
//}
source "vsphere-iso" "debian-12" {
source "vsphere-iso" "debian-12-x64" {
vcenter_server = var.vcenter_server
username = var.vcenter_username
password = var.vcenter_password
@ -70,7 +70,7 @@ source "vsphere-iso" "debian-12" {
build {
name = "template"
sources = ["source.vsphere-iso.debian-12"]
sources = ["source.vsphere-iso.debian-12-x64"]
provisioner "file" {
destination = "/tmp/prep-script.sh"

View File

@ -19,11 +19,11 @@ d-i clock-setup/utc boolean true
# Package Configuration
d-i pkgsel/upgrade select full-upgrade
d-i apt-setup/services-select multiselect security, updates
#d-i mirror/country string TR
d-i mirror/country string manual
d-i mirror/http/hostname string 192.168.111.251
d-i mirror/http/directory string /debian
d-i apt-setup/security_host string 192.168.111.251
d-i mirror/country string TR
#d-i mirror/country string manual
#d-i mirror/http/hostname string 192.168.111.251
#d-i mirror/http/directory string /debian
#d-i apt-setup/security_host string 192.168.111.251
d-i apt-setup/non-free-firmware boolean true
d-i apt-setup/non-free boolean true
@ -102,7 +102,7 @@ d-i debian-installer/splash boolean false
d-i finish-install/reboot_in_progress note
d-i preseed/late_command string in-target /bin/sh -c '/bin/echo "send dhcp-client-identifier = hardware;" >> /etc/dhcp/dhclient.conf'; \
in-target mkdir -p /home/ansb-srv-it/.ssh; \
in-target /bin/sh -c "echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC21HOAhC6o25M1oKxKsZxIoxUUeIpb4oqtAdPRNGU4PhJL1g1Cnro+YeF36YnvTKHRzDxS211y/zZBkt7BxOM7qj6dTQSH23jRwGLyfcYv7VyrK1YoxUAXumOJYnhfjVhXoznKnY9++GO9a/1gxQCzjGFMoxAQxFiBMbR/3Ic92ix2SM5aftXl1Mvu3mv45iZimyVIOH5cXdC0XtDSC7EEsdp1Ex6H/GfYabS+cJ55Uyct3orVBSf1LYFLaBNpIx7evXe+bXl81pvW8k/JhYTizoYNEA9rCi+1zaLQMb5LviHM3QqiYjkJbdt2Bd6TVmAfXrJKkj5XXnaMcDqXg8VUKqBenWOSugwagjYYjPRN/pyOeucL+pW1+iv8rAsVxn/0/eliNMn4rExN+Bj6kOmmdrsfqfierffW4DGDJtZlZhfXeZTX8XhdwMt7QUsUdK/Mr14uaEGjhWywX7uqSTnySV1mG4f6vJOyJksZKNSDzK8zH4k3u3onBFbut6NRG+cW4DaScmDbxAkUyurpesPlQkZzcKit6LLscJWZqCrd09zUvHuktnLuhlcicPQPD0B3VhbqVjTvjTDqZX8ZdxrHaRFwfKtv+gqo5Xb2ziS9MxsslxrSe9Ss4w4XkfbZ3BMnyfJWgxHuuyp4Y9gVRE4pFmsoR3v1zpTTHzMGKJKXWw== root@ansible' >> /home/ansb-srv-it/.ssh/authorized_keys"; \
in-target /bin/sh -c "echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC21HOAhC6o25M1oKxKsZxIoxUUeIpb4oqtAdPRNGU4PhJL1g1Cnro+YeF36YnvTKHRzDxS211y/zZBkt7BxOM7qj6dTQSH23jRwGLyfcYv7VyrK1YoxUAXumOJYnhfjVhXoznKnY9++GO9a/1gxQCzjGFMoxAQxFiBMbR/3Ic92ix2SM5aftXl1Mvu3mv45iZimyVIOH5cXdC0XtDSC7EEsdp1Ex6H/GfYabS+cJ55Uyct3orVBSf1LYFLaBNpIx7evXe+bXl81pvW8k/JhYTizoYNEA9rCi+1zaLQMb5LviHM3QqiYjkJbdt2Bd6TVmAfXrJKkj5XXnaMcDqXg8VUKqBenWOSugwagjYYjPRN/pyOeucL+pW1+iv8rAsVxn/0/eliNMn4rExN+Bj6kOmmdrsfqfierffW4DGDJtZlZhfXeZTX8XhdwMt7QUsUdK/Mr14uaEGjhWywX7uqSTnySV1mG4f6vJOyJksZKNSDzK8zH4k3u3onBFbut6NRG+cW4DaScmDbxAkUyurpesPlQkZzcKit6LLscJWZqCrd09zUvHuktnLuhlcicPQPD0B3VhbqVjTvjTDqZX8ZdxrHaRFwfKtv+gqo5Xb2ziS9MxsslxrSe9Ss4w4XkfbZ3BMnyfJWgxHuuyp4Y9gVRE4pFmsoR3v1zpTTHzMGKJKXWw== ansible@user' >> /home/ansb-srv-it/.ssh/authorized_keys"; \
in-target chown -R ansb-srv-it:ansb-srv-it /home/ansb-srv-it; \
in-target chmod 700 /home/ansb-srv-it; \
in-target chmod 600 /home/ansb-srv-it/.ssh/authorized_keys; \
@ -110,6 +110,6 @@ in-target chmod 700 /home/ansb-srv-it/.ssh; \
in-target usermod -aG sudo ansb-srv-it; \
in-target usermod -p '*' ansb-srv-it; \
in-target usermod -p '*' root; \
in-target /bin/sh -c "echo 'ansb-srv-it ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/ansb-srv-it"; \
in-target /bin/sh -c "echo 'ansb-srv-it ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/ansb-srv-it"; \
in-target chmod 440 /etc/sudoers.d/ansb-srv-it; \
in-target echo