mirror of
https://github.com/GNS3/gns3-registry.git
synced 2024-12-18 20:37:57 +00:00
Added Ubuntu cloud image package
This commit is contained in:
parent
715addcab6
commit
f5c915b710
9
cloud-init/ubuntu-cloud/README.md
Normal file
9
cloud-init/ubuntu-cloud/README.md
Normal 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
|
||||
```
|
2
cloud-init/ubuntu-cloud/meta-data
Normal file
2
cloud-init/ubuntu-cloud/meta-data
Normal file
@ -0,0 +1,2 @@
|
||||
instance-id: ubuntu-cloud
|
||||
local-hostname: ubuntu-cloud
|
BIN
cloud-init/ubuntu-cloud/ubuntu-cloud-init-data.iso
Normal file
BIN
cloud-init/ubuntu-cloud/ubuntu-cloud-init-data.iso
Normal file
Binary file not shown.
5
cloud-init/ubuntu-cloud/user-data
Normal file
5
cloud-init/ubuntu-cloud/user-data
Normal file
@ -0,0 +1,5 @@
|
||||
#cloud-config
|
||||
|
||||
password: ubuntu
|
||||
chpasswd: { expire: False }
|
||||
ssh_pwauth: True
|
51
packer/ubuntu/jammy.json
Normal file
51
packer/ubuntu/jammy.json
Normal 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"
|
||||
}
|
||||
}
|
||||
|
5
packer/ubuntu/scripts/jammy.sh
Normal file
5
packer/ubuntu/scripts/jammy.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
|
||||
# create GNS3 user
|
||||
printf 'gns3\ngns3\n' | adduser --gecos 'GNS3' gns3
|
14
packer/ubuntu/scripts/post_setup.sh
Normal file
14
packer/ubuntu/scripts/post_setup.sh
Normal 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
|
7
packer/ubuntu/scripts/upgrade-os.sh
Normal file
7
packer/ubuntu/scripts/upgrade-os.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
|
||||
# clear repository
|
||||
apt update
|
||||
|
||||
apt upgrade -y
|
1
packer/ubuntu/ubuntu-cloud-init-data.iso
Symbolic link
1
packer/ubuntu/ubuntu-cloud-init-data.iso
Symbolic link
@ -0,0 +1 @@
|
||||
../../cloud-init/ubuntu-cloud/ubuntu-cloud-init-data.iso
|
Loading…
Reference in New Issue
Block a user