From 1c5c97532c91faf8a59bbe7ebcfc645f653db697 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 27 Feb 2021 07:54:40 +0200 Subject: feat: export cloud-init config, set SSH host keys --- vmadm.md | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 84 insertions(+), 21 deletions(-) (limited to 'vmadm.md') diff --git a/vmadm.md b/vmadm.md index a63370c..9d05b2a 100644 --- a/vmadm.md +++ b/vmadm.md @@ -1,25 +1,6 @@ -# Create a virtual machine - -This scenario verifies that vmadm can create a virtual machine and -that the user can log into it as root via SSH after it has booted. -This requires that the environment it set up so that virtual machines -can be addressed by name. - -~~~scenario -given an installed vmadm -given file smoke.yaml -given file .ssh/id_rsa from ssh_key -given file .ssh/id_rsa.pub from ssh_key_pub -given file .ssh/config from ssh_config -when I invoke vmadm new smoke.yaml -when I invoke ssh -F .ssh/config debian@smoke hostname -then stdout contains "smoke" -when I invoke ssh -F .ssh/config debian@smoke df -h / -then stdout contains "4.9G" -when I invoke ssh -F .ssh/config debian@smoke free -m -then stdout contains "1997" -~~~ +# Data files for scenarios +This section has some data files used by scenarios. ~~~{#smoke.yaml .file .yaml} name: smoke @@ -74,6 +55,88 @@ host * passwordauthentication=no ~~~ +# Cloud-init configuration + +This scenario verifies that vmadm creates the cloud-init configuration +correctly. + +~~~scenario +given an installed vmadm +given file init.yaml +given file .ssh/id_rsa.pub from init_ssh_key_pub +given file expected/meta-data from init-metadata +given file expected/user-data from init-userdata +when I invoke vmadm cloud-init init.yaml actual +then directories actual and expected are identical +~~~ + +~~~{#init.yaml .file .yaml} +name: init-test +ssh_key_files: + - .ssh/id_rsa.pub +rsa_host_key: rsa-private +rsa_host_cert: rsa-certificate +dsa_host_key: dsa-private +dsa_host_cert: dsa-certificate +ecdsa_host_key: ecdsa-private +ecdsa_host_cert: ecdsa-certificate +ed25519_host_key: ed25519-private +ed25519_host_cert: ed25519-certificate +base: /home/liw/tmp/debian-10-openstack-amd64.qcow2 +image: init.qcow2 +image_size_gib: 5 +memory_mib: 2048 +cpus: 1 +~~~ + +~~~{#init_ssh_key_pub .file} +init-authz-key +~~~ + +~~~{#init-metadata .file} +# Amazon EC2 style metadata +local-hostname: init-test +~~~ + +~~~{#init-userdata .file} +#cloud-config +ssh_authorized_keys: + - init-authz-key +ssh_keys: + rsa_private: rsa-private + rsa_certificate: rsa-certificate + dsa_private: dsa-private + dsa_certificate: dsa-certificate + ecdsa_private: ecdsa-private + ecdsa_certificate: ecdsa-certificate + ed25519_private: ed25519-private + ed25519_certificate: ed25519-certificate +~~~ + +# Create a virtual machine + +This scenario verifies that vmadm can create a virtual machine and +that the user can log into it as root via SSH after it has booted. +This requires that the environment it set up so that virtual machines +can be addressed by name. + +~~~scenario +given an installed vmadm +given file smoke.yaml +given file .ssh/id_rsa from ssh_key +given file .ssh/id_rsa.pub from ssh_key_pub +given file .ssh/config from ssh_config +when I invoke vmadm new smoke.yaml +when I invoke ssh -F .ssh/config debian@smoke hostname +then stdout contains "smoke" +when I invoke ssh -F .ssh/config debian@smoke df -h / +then stdout contains "4.9G" +when I invoke ssh -F .ssh/config debian@smoke free -m +then stdout contains "1997" +~~~ + + + # Colophon -- cgit v1.2.1