feat: Add pxe example and new data files structure
This commit is contained in:
32
examples/okd_pxe/src/main.rs
Normal file
32
examples/okd_pxe/src/main.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
mod topology;
|
||||
|
||||
use harmony::{
|
||||
modules::{dhcp::DhcpScore, tftp::TftpScore},
|
||||
score::Score,
|
||||
topology::{HAClusterTopology, Url},
|
||||
};
|
||||
|
||||
use crate::topology::{get_inventory, get_topology};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let inventory = get_inventory();
|
||||
let topology = get_topology().await;
|
||||
let gateway_ip = topology.router.get_gateway();
|
||||
|
||||
let scores: Vec<Box<dyn Score<HAClusterTopology>>> = vec![
|
||||
Box::new(DhcpScore {
|
||||
host_binding: vec![],
|
||||
next_server: Some(topology.router.get_gateway()),
|
||||
boot_filename: None,
|
||||
filename: Some("undionly.kpxe".to_string()),
|
||||
filename64: Some("ipxe.efi".to_string()),
|
||||
filenameipxe: Some(format!("http://{gateway_ip}:8080/boot.ipxe").to_string()),
|
||||
}),
|
||||
Box::new(TftpScore {
|
||||
files_to_serve: Url::LocalFolder("./data/pxe/okd/tftpboot/".to_string()),
|
||||
}),
|
||||
];
|
||||
|
||||
harmony_cli::run(inventory, topology, scores, None).await.unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user