Skip to content

Commit 8b8e868

Browse files
committed
Added Ubuntu 20.04 LTS (Focal Fossa)
1 parent 6bde1ab commit 8b8e868

File tree

4 files changed

+123
-0
lines changed

4 files changed

+123
-0
lines changed

ubuntu/build-ubuntu-20.04.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
echo "Building Ubuntu 20.04.2 LTS (Focal Fossa) template"
4+
5+
packer build -force -var-file=../clouds/var-infra-z67.json ubuntu-20.04.json

ubuntu/http/20.04/meta-data

Whitespace-only changes.

ubuntu/http/20.04/user-data

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#cloud-config
2+
autoinstall:
3+
version: 1
4+
locale: en_US
5+
keyboard:
6+
layout: en
7+
variant: us
8+
network:
9+
network:
10+
version: 2
11+
ethernets:
12+
ens192:
13+
dhcp4: true
14+
storage:
15+
layout:
16+
name: lvm
17+
identity:
18+
hostname: ubuntu-packer
19+
username: packer
20+
password: $6$yRp1sC9EfcWC6bg$JLJ8y/UPg6EQsyjIck78qvO6/TdA8wnzeiBPyICI2jwWtU0.sYEpyY4fSxmbVAeB74zgPdVECE/aeW4alye2X0
21+
ssh:
22+
install-server: yes
23+
allow-pw: true
24+
user-data:
25+
disable_root: false
26+
late-commands:
27+
- echo 'packer ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/packer

ubuntu/ubuntu-20.04.json

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"variables":
3+
{
4+
"author": "Romain Decker",
5+
"website": "https://cloudmaniac.net",
6+
"description": "Creation of a Ubuntu 20.04.2.0 LTS (Focal Fossa) vSphere template",
7+
"var_vm_name": "packer-ubuntu-20.04",
8+
"var_vm_hostname": "packer-ubuntu-20.04",
9+
"var_vsphere_template_folder": "templates/packer/ubuntu",
10+
"var_vm_guestos": "ubuntu64Guest",
11+
"var_vm_cpu_size": "1",
12+
"var_vm_ram_size": "1024",
13+
"var_vm_disk_controller": "pvscsi",
14+
"var_vm_disk_size": "16384",
15+
"var_vm_notes": "Ubuntu 20.04.2.0 LTS (Focal Fossa) - {{isotime \"2006-01-02\"}}",
16+
"var_iso_url": "https://releases.ubuntu.com/20.04/ubuntu-20.04.2-live-server-amd64.iso",
17+
"var_iso_checksum_type": "sha256",
18+
"var_iso_checksum": "d1f2bf834bbe9bb43faf16f9be992a6f3935e65be0edece1dee2aa6eb1767423",
19+
"var_http_path": "20.04",
20+
"var_guest_username": "packer",
21+
"var_guest_password": "VMware1!"
22+
}
23+
,
24+
"builders": [
25+
{
26+
"type": "vsphere-iso",
27+
28+
"vcenter_server": "{{user `var_vsphere_vcenter`}}",
29+
"username": "{{user `var_vsphere_username`}}",
30+
"password": "{{user `var_vsphere_password`}}",
31+
"insecure_connection": "true",
32+
33+
"datacenter": "{{user `var_vsphere_datacenter`}}",
34+
"cluster": "{{user `var_vsphere_cluster`}}",
35+
"folder": "{{user `var_vsphere_template_folder`}}",
36+
"datastore": "{{user `var_vsphere_datastore`}}",
37+
"network_adapters": [
38+
{
39+
"network": "{{user `var_vsphere_network`}}",
40+
"network_card": "vmxnet3"
41+
}
42+
],
43+
"convert_to_template": "true",
44+
45+
"vm_name": "{{user `var_vm_name`}}",
46+
"guest_os_type": "{{user `var_vm_guestos`}}",
47+
48+
"CPUs": "{{user `var_vm_cpu_size`}}",
49+
"RAM": "{{user `var_vm_ram_size`}}",
50+
"disk_controller_type": "{{user `var_vm_disk_controller`}}",
51+
"storage": [
52+
{
53+
"disk_size": "{{user `var_vm_disk_size`}}",
54+
"disk_thin_provisioned": true
55+
}
56+
],
57+
"notes": "{{user `var_vm_notes`}}",
58+
59+
"communicator":"ssh",
60+
"ssh_username": "{{user `var_guest_username`}}",
61+
"ssh_password": "{{user `var_guest_password`}}",
62+
"ssh_timeout": "30m",
63+
"ssh_handshake_attempts": "200",
64+
65+
"iso_urls": "{{user `var_iso_url`}}",
66+
"iso_checksum": "{{user `var_iso_checksum_type`}}:{{user `var_iso_checksum`}}",
67+
68+
"http_directory": "http/{{user `var_http_path`}}",
69+
70+
"boot_wait": "5s",
71+
"boot_command": [
72+
"<esc><wait><esc><wait><f6><wait><esc><wait>",
73+
"autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ",
74+
"--- <enter>"
75+
],
76+
"shutdown_command": "echo '{{user `var_guest_password`}}' | sudo -S -E shutdown -P now"
77+
}],
78+
"provisioners": [{
79+
"execute_command": "echo '{{user `var_guest_password`}}' | sudo -S -E bash '{{.Path}}'",
80+
"scripts": [
81+
"./scripts/update.sh",
82+
"./scripts/cleanup.sh"
83+
],
84+
"type": "shell"
85+
},
86+
{
87+
"inline": "echo 'Template build complete ({{isotime \"2006-01-02 03:04:05\"}})!'",
88+
"type": "shell"
89+
}
90+
]
91+
}

0 commit comments

Comments
 (0)