From f1d16990b5df01bcf240184921d6cea98126bcb1 Mon Sep 17 00:00:00 2001 From: Stephen Simpson Date: Tue, 22 Apr 2025 12:54:55 -0500 Subject: [PATCH] Add documentation for wwctl import Signed-off-by: Stephen Simpson --- CHANGELOG.md | 1 + userdocs/nodes/nodes.rst | 78 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6bfdc10..b45ae406 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/userdocs/nodes/nodes.rst b/userdocs/nodes/nodes.rst index 8fb1feb7..f9465ec6 100644 --- a/userdocs/nodes/nodes.rst +++ b/userdocs/nodes/nodes.rst @@ -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 `_ + 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