diff --git a/README.md b/README.md index 31b7eef9b..27b3f1d2b 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,10 @@ The Ubuntu cloud images do not ship with a default password so it necessary to use a `cloud-init` disk image to customise the image on the first boot. A basic `cloud-init` image is generated by this [script](scripts/create-cloud-init.sh). This seeds the image with a default username/password of `cloud/cloud123`. It -is only necessary to add this disk image on the first boot. +is only necessary to add this disk image on the first boot. Script also assigns +default IP address using `test_data/cloud-init/ubuntu/local/network-config` details +with `--net "mac=12:34:56:78:90:ab,tap="` option. Then the matching mac address +interface will be enabled as per `network-config` details. ```shell $ sudo setcap cap_net_admin+ep ./cloud-hypervisor diff --git a/scripts/create-cloud-init.sh b/scripts/create-cloud-init.sh index 9045afde8..2022c0cb2 100755 --- a/scripts/create-cloud-init.sh +++ b/scripts/create-cloud-init.sh @@ -3,7 +3,7 @@ set -x rm -f /tmp/ubuntu-cloudinit.img mkdosfs -n CIDATA -C /tmp/ubuntu-cloudinit.img 8192 -mcopy -oi /tmp/ubuntu-cloudinit.img -s test_data/cloud-init/ubuntu/user-data :: -mcopy -oi /tmp/ubuntu-cloudinit.img -s test_data/cloud-init/ubuntu/meta-data :: -mcopy -oi /tmp/ubuntu-cloudinit.img -s test_data/cloud-init/ubuntu/network-config :: +mcopy -oi /tmp/ubuntu-cloudinit.img -s test_data/cloud-init/ubuntu/local/user-data :: +mcopy -oi /tmp/ubuntu-cloudinit.img -s test_data/cloud-init/ubuntu/local/meta-data :: +mcopy -oi /tmp/ubuntu-cloudinit.img -s test_data/cloud-init/ubuntu/local/network-config :: diff --git a/test_data/cloud-init/ubuntu/local/meta-data b/test_data/cloud-init/ubuntu/local/meta-data new file mode 100644 index 000000000..bf8691957 --- /dev/null +++ b/test_data/cloud-init/ubuntu/local/meta-data @@ -0,0 +1,2 @@ +instance-id: cloud +local-hostname: cloud diff --git a/test_data/cloud-init/ubuntu/local/network-config b/test_data/cloud-init/ubuntu/local/network-config new file mode 100644 index 000000000..99df95a77 --- /dev/null +++ b/test_data/cloud-init/ubuntu/local/network-config @@ -0,0 +1,7 @@ +version: 2 +ethernets: + ens4: + match: + macaddress: 12:34:56:78:90:ab + addresses: [192.168.249.2/24] + gateway4: 192.168.249.1 diff --git a/test_data/cloud-init/ubuntu/local/user-data b/test_data/cloud-init/ubuntu/local/user-data new file mode 100644 index 000000000..b064234bc --- /dev/null +++ b/test_data/cloud-init/ubuntu/local/user-data @@ -0,0 +1,10 @@ +#cloud-config +users: + - name: cloud + passwd: $6$7125787751a8d18a$sHwGySomUA1PawiNFWVCKYQN.Ec.Wzz0JtPPL1MvzFrkwmop2dq7.4CYf03A5oemPQ4pOFCCrtCelvFBEle/K. + sudo: ALL=(ALL) NOPASSWD:ALL + lock_passwd: False + inactive: False + shell: /bin/bash + +ssh_pwauth: True