- Lab
- A Cloud Guru
Initializing LXD Using a Preseed File
When configuring multiple LXD hosts, either to work alongside a remote or as isolated environments, it saves time to bypass the prompt and instead use a preseed file for LXD configuration. In this lab, we generate our preseed file, then create two identical dev environments using our newly-created file.
Path Info
Table of Contents
-
Challenge
Generate the Preseed File
- Configure LXD on the first host:
lxd init
Would you like to use LXD clustering? (yes/no) [default=no]: Do you want to configure a new storage pool? (yes/no) [default=yes]: Name of the new storage pool [default=default]: Name of the storage backend to use (btrfs, ceph, dir, lvm, zfs) [default=zfs]: Create a new ZFS pool? (yes/no) [default=yes]: Would you like to use an existing block device? (yes/no) [default=no]: yes Path to the existing block device: /dev/nvme1n1 Would you like to connect to a MAAS server? (yes/no) [default=no]: Would you like to create a new local network bridge? (yes/no) [default=yes]: What should the new bridge be called? [default=lxdbr0]: What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: Would you like LXD to be available over the network? (yes/no) [default=no]: yes Address to bind LXD to (not including port) [default=all]: Port to bind LXD to [default=8443]: Trust password for new clients: Again: Would you like stale cached images to be updated automatically? (yes/no) [default=yes] Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]: yes
- Copy the provided preseed output and save it to a file in the home directory called
preseed.yaml
:
vim preseed.yaml config: core.https_address: '[::]:8443' core.trust_password: pinehead networks: - config: ipv4.address: auto ipv6.address: auto description: "" managed: false name: lxdbr0 type: "" storage_pools: - config: source: /dev/nvme1n1 description: "" name: default driver: zfs profiles: - config: {} description: "" devices: eth0: name: eth0 nictype: bridged parent: lxdbr0 type: nic root: path: / pool: default type: disk name: default cluster: null
-
Challenge
Configure the Second Server
- Copy over the preseed file:
scp [email protected]:/home/cloud_user/preseed.yaml preseed.yaml
- Configure LXD:
cat preseed.yaml | lxd init --preseed
-
Challenge
Configure the Third Server
Repeat the steps from the second server, or try with a single command:
scp [email protected]:/home/cloud_user/preseed.yaml preseed.yaml | cat preseed.yaml | lxd init --preseed
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.