Added Ubuntu cloud image package

This commit is contained in:
Eliezer Croitoru 2022-12-23 06:04:26 +02:00
parent 715addcab6
commit f5c915b710
9 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,9 @@
# Ubuntu-cloud cloud-init-data image for GNS3 virtual appliance
Generated using the following commands:
```
printf "#cloud-config\n\npassword: ubuntu\nchpasswd: { expire: False }\nssh_pwauth: True\n" > user-data
printf "instance-id: ubuntu-cloud\nlocal-hostname: ubuntu-cloud\n" > meta-data
mkisofs -output ubuntu-cloud-init-data.iso -volid cidata -joliet -rock user-data meta-data
```

View File

@ -0,0 +1,2 @@
instance-id: ubuntu-cloud
local-hostname: ubuntu-cloud

Binary file not shown.

View File

@ -0,0 +1,5 @@
#cloud-config
password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True

51
packer/ubuntu/jammy.json Normal file
View File

@ -0,0 +1,51 @@
{
"builders": [
{
"disk_compression": true,
"disk_image": true,
"disk_interface": "virtio-scsi",
"disk_size": "{{user `disk_size`}}",
"headless": true,
"iso_checksum": "sha256:{{user `iso_checksum`}}",
"iso_url": "{{user `iso_url`}}",
"net_device": "virtio-net-pci",
"qemuargs": [
[
"-cdrom",
"ubuntu-cloud-init-data.iso"
]
],
"shutdown_command": "sudo shutdown -P now",
"ssh_password": "ubuntu",
"ssh_timeout": "120s",
"ssh_username": "ubuntu",
"type": "qemu",
"vm_name": "{{user `vm_name`}}"
}
],
"provisioners": [
{
"execute_command": "sudo env {{ .Vars }} {{ .Path }}",
"script": "scripts/{{user `setup_script`}}",
"type": "shell"
},
{
"execute_command": "sudo env {{ .Vars }} {{ .Path }}",
"script": "scripts/upgrade-os.sh",
"type": "shell"
},
{
"execute_command": "sudo env {{ .Vars }} {{ .Path }}",
"script": "scripts/post_setup.sh",
"type": "shell"
}
],
"variables": {
"disk_size": "10G",
"iso_checksum": "8ae2ebcaf1320ea5b8d7003b44f2dbcb4ecad8cc53a3170e96d9ff1bbe8f78b8",
"iso_url": "https://cloud-images.ubuntu.com/jammy/20221219/jammy-server-cloudimg-amd64.img",
"setup_script": "jammy.sh",
"vm_name": "ubuntu-jammy.qcow2"
}
}

View File

@ -0,0 +1,5 @@
#!/bin/sh
set -ex
# create GNS3 user
printf 'gns3\ngns3\n' | adduser --gecos 'GNS3' gns3

View File

@ -0,0 +1,14 @@
#!/bin/sh
set -ex
# clear repository
apt-get clean
apt-get autoremove --yes
rm -rf /var/lib/{apt,dpkg,cache,log}/
# clear unused space
echo 'Clearing unused space...'
dd if=/dev/zero bs=1M of=/zero >/dev/null 2>&1 || true; rm -f /zero
sync

View File

@ -0,0 +1,7 @@
#!/bin/sh
set -ex
# clear repository
apt update
apt upgrade -y

View File

@ -0,0 +1 @@
../../cloud-init/ubuntu-cloud/ubuntu-cloud-init-data.iso