[pve-devel] [RFC installer 0/6] add automated installation

Aaron Lauterer a.lauterer at proxmox.com
Tue Sep 5 15:28:26 CEST 2023


This is the first iteration of making it possible to automatically run
the installer.

The main idea is to provide an answer file (TOML as of now) that
provides the properties usually queried by the TUI or GUI installer.
Additionally we want to be able to do some more fuzzy matching for the
NIC and disks used by the installer.

Therefore we have some basic globbing/wildcard support at the start and
end of the search string. For now the UDEV device properties are used to
for this matching. The format for the filters are "UDEV KEY -> search
string".

The answer file and auto installer have the additional option to run
commands pre- and post-installation. More details can be found in the
patch itself.

The big question is how we actually get the answer file without creating
a custom installer image per answer file.
The most basic variant is to scan local storage for a partition/volume
with an expected label, mount it and look for the expected file.
For this I added a small shell script that does exactly this and then
starts the auto installer.

Another idea is to get an URL and query it
* could come from a default subdomain that is queried within the DHCP
  provided search domain
* We could get it from a DHCP option. How we extract that is something I
  don't know at this time.
* From the kernel cmdline, if the installer is booted via PXE with
  customized kernel parameters
* ...

When running the http request, we could add identifying properties as
parameters. Properties like MAC addresses and serial numbers, for
example. This would make it possible to have a script querying an
internal database and create the answer file on demand.

This version definitely has some rough edges and probably a lot of
things that could be done nicer, more idiomatic. There are quite a few
nested for loops that could probably be done better/nicer as well.

A lot of code has been reused from the TUI installer. The plan is to
factor out common code into a new library crate.

For now, the auto installer just prints everything to stdout. We could
implement a simple GUI that shows a progress bar.


pve-install: Aaron Lauterer (5):
  low level: sys: fetch udev properties
  add proxmox-auto-installer
  add answer file fetch script
  makefile: fix handling of multiple usr_bin files
  makefile: add auto installer

 Cargo.toml                                    |   1 +
 Makefile                                      |   8 +-
 Proxmox/Makefile                              |   1 +
 Proxmox/Sys/Udev.pm                           |  54 +++
 proxmox-auto-installer/Cargo.toml             |  13 +
 proxmox-auto-installer/answer.toml            |  36 ++
 .../resources/test/iso-info.json              |   1 +
 .../resources/test/locales.json               |   1 +
 .../test/parse_answer/disk_match.json         |  28 ++
 .../test/parse_answer/disk_match.toml         |  14 +
 .../test/parse_answer/disk_match_all.json     |  25 +
 .../test/parse_answer/disk_match_all.toml     |  16 +
 .../test/parse_answer/disk_match_any.json     |  32 ++
 .../test/parse_answer/disk_match_any.toml     |  16 +
 .../resources/test/parse_answer/minimal.json  |  17 +
 .../resources/test/parse_answer/minimal.toml  |  14 +
 .../test/parse_answer/nic_matching.json       |  17 +
 .../test/parse_answer/nic_matching.toml       |  19 +
 .../resources/test/parse_answer/readme        |   4 +
 .../test/parse_answer/specific_nic.json       |  17 +
 .../test/parse_answer/specific_nic.toml       |  19 +
 .../resources/test/parse_answer/zfs.json      |  26 +
 .../resources/test/parse_answer/zfs.toml      |  19 +
 .../resources/test/run-env-info.json          |   1 +
 .../resources/test/run-env-udev.json          |   1 +
 proxmox-auto-installer/src/answer.rs          | 144 ++++++
 proxmox-auto-installer/src/main.rs            | 412 ++++++++++++++++
 proxmox-auto-installer/src/tui/mod.rs         |   3 +
 proxmox-auto-installer/src/tui/options.rs     | 302 ++++++++++++
 proxmox-auto-installer/src/tui/setup.rs       | 447 ++++++++++++++++++
 proxmox-auto-installer/src/tui/utils.rs       | 268 +++++++++++
 proxmox-auto-installer/src/udevinfo.rs        |   9 +
 proxmox-auto-installer/src/utils.rs           | 325 +++++++++++++
 proxmox-low-level-installer                   |  14 +
 start_autoinstall.sh                          |  50 ++
 35 files changed, 2372 insertions(+), 2 deletions(-)
 create mode 100644 Proxmox/Sys/Udev.pm
 create mode 100644 proxmox-auto-installer/Cargo.toml
 create mode 100644 proxmox-auto-installer/answer.toml
 create mode 100644 proxmox-auto-installer/resources/test/iso-info.json
 create mode 100644 proxmox-auto-installer/resources/test/locales.json
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/disk_match.json
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/disk_match.toml
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/disk_match_all.json
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/disk_match_all.toml
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/disk_match_any.json
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/disk_match_any.toml
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/minimal.json
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/minimal.toml
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/nic_matching.json
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/nic_matching.toml
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/readme
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/specific_nic.json
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/specific_nic.toml
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/zfs.json
 create mode 100644 proxmox-auto-installer/resources/test/parse_answer/zfs.toml
 create mode 100644 proxmox-auto-installer/resources/test/run-env-info.json
 create mode 100644 proxmox-auto-installer/resources/test/run-env-udev.json
 create mode 100644 proxmox-auto-installer/src/answer.rs
 create mode 100644 proxmox-auto-installer/src/main.rs
 create mode 100644 proxmox-auto-installer/src/tui/mod.rs
 create mode 100644 proxmox-auto-installer/src/tui/options.rs
 create mode 100644 proxmox-auto-installer/src/tui/setup.rs
 create mode 100644 proxmox-auto-installer/src/tui/utils.rs
 create mode 100644 proxmox-auto-installer/src/udevinfo.rs
 create mode 100644 proxmox-auto-installer/src/utils.rs
 create mode 100755 start_autoinstall.sh


pve-docs: Aaron Lauterer (1):
  installation: add unattended documentation

 pve-installation.adoc | 245 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 245 insertions(+)

-- 
2.39.2






More information about the pve-devel mailing list