From d8bce5885ba032a10a9f23ad8ece9dd4f9599b9e Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Thu, 16 Nov 2023 19:56:53 +0000 Subject: [PATCH] docs: Add instructions to run libvirt with (#4578) Also organize other "how to run cloud-init locally" content better. Fixes GH-4608 --- doc/rtd/howto/run_cloud_init_locally.rst | 84 ++++++++++++++++++++---- 1 file changed, 72 insertions(+), 12 deletions(-) diff --git a/doc/rtd/howto/run_cloud_init_locally.rst b/doc/rtd/howto/run_cloud_init_locally.rst index 9c883eb8c182..20a056614d1b 100644 --- a/doc/rtd/howto/run_cloud_init_locally.rst +++ b/doc/rtd/howto/run_cloud_init_locally.rst @@ -19,8 +19,11 @@ The ``NoCloud`` datasouce allows users to provide their own user data, metadata, or network configuration directly to an instance without running a network service. This is helpful for launching local cloud images with QEMU. -The following is an example of creating the local disk using the -:command:`genisoimage` command: +Create your configuration +------------------------- +We will leave the network-config and meta-data files empty, but populate +user-data with a cloud-init configuration. You may edit the network and +meta-data files if you have a config to provide. .. code-block:: shell-session @@ -32,10 +35,12 @@ The following is an example of creating the local disk using the chpasswd: expire: False ssh_pwauth: True - ssh_authorized_keys: - - ssh-rsa AAAA...UlIsqdaO+w== EOF +Create an iso disk +------------------ +This disk is used to pass configuration to cloud-init. Create it with the +:command:`genisoimage` command: .. code-block:: shell-session @@ -44,24 +49,35 @@ The following is an example of creating the local disk using the -volid cidata -rational-rock -joliet \ user-data meta-data network-config -See the :ref:`network_config_v2` page for details on the format and config of -network configuration. To learn more about the possible values for metadata, -check out the :ref:`datasource_nocloud` page. -The resulting :file:`seed.img` can then be passed along to a cloud image -containing ``cloud-init``. Below is an example of passing the :file:`seed.img` -with QEMU: +Download a cloud image +---------------------- +Download a Ubuntu image to run: + +.. code-block:: shell-session + + wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img + +Boot the image with the iso attached +------------------------------------ +Pass the :file:`seed.img` with QEMU: .. code-block:: shell-session $ qemu-system-x86_64 -m 1024 -net nic -net user \ - -hda ubuntu-20.04-server-cloudimg-amd64.img \ + -hda jammy-server-cloudimg-amd64.img \ -hdb seed.img The now-booted image will allow for login using the password provided above. For additional configuration, users can provide much more detailed -configuration, including network configuration and metadata: +configuration in the empty files network-config and meta-data. + +.. note:: + + See the :ref:`network_config_v2` page for details on the format and config + of network configuration. To learn more about the possible values for + metadata, check out the :ref:`datasource_nocloud` page. LXD === @@ -109,6 +125,50 @@ See the LXD `Instance Configuration`_ docs for more info about configuration values or the LXD `Custom Network Configuration`_ document for more about custom network config. +Libvirt +======= + +Libvirt is tool for managing virtual machines and containers. + +Create your configuration +------------------------- + +We will leave the network-config and meta-data files empty, but populate +user-data with a cloud-init configuration. You may edit the network and +meta-data files if you have a config to provide. + +.. code-block:: shell-session + + $ touch network-config + $ touch meta-data + $ cat >user-data <