Merge pull request #1870 from ssimpson89/add-node-import

Update documentation to include instruction for using wwctl node import
This commit is contained in:
Jonathon Anderson
2025-06-03 01:48:50 -06:00
committed by GitHub
2 changed files with 79 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Added override.conf for nm-wait-online-initrd.service with dracut.
- Added userdocs for `wwctl node import` from yaml/csv.
### Fixed

View File

@@ -199,3 +199,81 @@ overlays.
passno: 0
Resources can only be managed with ``wwctl node edit``.
Importing Nodes From a File
===========================
You can import nodes into Warewulf by using the ``wwctl node import`` command. The
file used must be in YAML or CSV format.
.. warning::
Importing a node configuration will fully overwrite the existing settings,
including any customizations not present in the import file. If the node
already exists and you wish to update it, ensure that the import file
includes all the options you want to retain.
CSV Import
----------
.. note::
As of Warewulf v4.6.1, the csv import functionality is broken and an
`issue <https://github.com/warewulf/warewulf/issues/1862>`_
has been created to track this.
The CSV file must have a header where the first field must always be the nodename,
and the rest of the fields are the same as the long commandline options. Network
device must have the form ``net.$NETNAME.$NETOPTION``. (e.g., ``net.default.ipaddr``).
Tags are currently not supported and must be added separately after the import.
As an example, the following CSV file:
.. code-block:: csv
nodename,net.default.hwaddr,net.default.ipaddr,net.default.netmask,net.default.gateway,discoverable,image
n1,00:00:00:00:00:01,10.0.2.1,255.255.255.0,10.0.2.254,false,rockylinux-9
This can be imported with the following command:
.. code-block:: shell
wwctl node import --csv /path/to/nodes.csv
YAML Import
-----------
The YAML file must be a mapping of node names to their attributes, where each node is represented as a dictionary of attributes.
To simplify the creation of the YAML file, you can use the wwctl node export command to export the current node configuration to a YAML file.
This exported file can serve as a template for creating new nodes.
A minimal example of a YAML file looks like this:
.. code-block:: yaml
n1:
profiles:
- default
image name: rockylinux-9
ipxe template: default
kernel:
args:
- quiet
- crashkernel=no
- nosplash
- console=ttyS0,115200
network devices:
default:
type: ethernet
device: eno1
hwaddr: "00:00:00:00:00:01"
ipaddr: 10.0.2.1
netmask: 255.255.255.0
gateway: 172.16.131.1
tags:
DNS1: 1.1.1.1
primary network: default
This can be imported with the following command:
.. code-block:: shell
wwctl node import /path/to/nodes.yaml