Followup Request to Proxmox-AIS Feature Request

proxdrop

New Member
Aug 16, 2024
28
3
3
Back in https://forum.proxmox.com/threads/proxmox-ais-question-request.153043/#post-695689 I had requested the "--partition-label" flag with proxmox-automatic-install-assistant tool. It works well but I was troubleshooting a hardware driver issue on some new servers, so I had to rebuild my iso. When I customized proxmox-installer prior, I also configured the program to search for any answer.toml file in the directory, not just "/mnt/answer/answer.toml". This lets me save each answer file and tie it to the server I'm currently configuring, allowing them to run in parallel. Currently, using the Dell Server Configuration Profile method, I can only refer to a file name to include. Either I specify a unique filename, which then Proxmox Installer fails to find, or I have to run installs singly and swap out the answer file each time. Dell documentation here: https://www.dell.com/support/manual...e7397f-19d5-4855-b6df-49b1c0cd4986&lang=en-us

Currently the directory structure ends up mounting as:
Code:
/mnt
/mnt/answer
/mnt/answer/hostprefix_answer.toml

Is there any way we can specify some kind of prefix, or otherwise make it so proxmox-fetch-answer isn't explicitly looking for /mnt/answer/answer.toml by default? Or leave it as default behavior, but be able to specify either a prefix or loosen it to discovering the first .toml or *answer.toml file?

Might as well include my shoddy rust code in partition.rs that I used for the first attempt. It functioned, but I know I don't know enough Rust to be of any real use:

code_language.rust:
static ANSWER_FILE: &str = "*answer.toml";
static ANSWER_MP: &str = "/mnt/answer";
// FAT can only handle 11 characters, so shorten Automated Installer Source to AIS
static PARTLABEL: &str = "oemdrv";
static DISK_BY_ID_PATH: &str = "/dev/disk/by-label";

pub struct FetchFromPartition;

impl FetchFromPartition {
    /// Returns the contents of the answer file
    pub fn get_answer() -> Result<String> {
        info!("Checking for answer file on partition.");

        let mut mount_path = PathBuf::from(mount_proxmoxinst_part()?);

        let search = format!("{}{}{}", ANSWER_MP, '/',  ANSWER_FILE);       
        info!("Searching {search:?}");

        mount_path.push(ANSWER_FILE);       

    let files: Result<Vec<_>, _> = glob(mount_path.to_str().unwrap()).expect("Failed to read path!").collect();
    let mut files = files.unwrap();
    files.sort();

    let file = files.first().unwrap();
    info!("Using: {:?}", file.display());
        let answer = fs::read_to_string(file)
            .map_err(|err| format_err!("failed to read answer file - {err}"))?;

        info!("Found answer file on partition.");

        Ok(answer)
    }
}
 
Hi,

the partition method was intentionally kept simple and not really designed to support installing multiple systems.
To give a bit of context: It was designed to be basically "single-use", for re-installing the same server (e.g. test servers), or for a very small fleet.
Or, for example, you got someone at a remote site (potentially without public network access) and want them to set up the target system, but without them needing to do anything other than load the prepared ISO from you, either via KVM or simply plugging in a flash drive.

If you have to usecase to (often) install multiple, different systems, I'd definitely recommend using the HTTP fetch method, which is made for more flexible situations.

There are loads of examples over at https://pve.proxmox.com/wiki/Automated_Installation.
You can either use your own server or modify one of the examples.

Or use Proxmox Datacenter Manager 1.1, which has full integration for automated installations: https://pdm.proxmox.com/docs/automated-installations.html
It supports granular matching of systems, authentication, and templating, which together should cover all needs.