feat: Improve Ubuntu installation and SSH execution
- Update example configuration comments - Refactor server rescue check to use file_exists - Add Ubuntu installation timeout and polling constants - Implement non-interactive installation script execution - Enhance SSH execution with argument parsing - Add check to skip reinstallation if Ubuntu is already installed - Copy SSH key to new system during installation - Poll for installation completion with progress updates - Use `node.exec` instead of `node.exec_interactive` - Use `execvp` correctly for shell execution - Recreate node connection after server reboot - Adjust SSH wait timeout to milliseconds
This commit is contained in:
@@ -1,35 +1,34 @@
|
||||
#!/usr/bin/env hero
|
||||
|
||||
// # Configure HetznerManager, replace with your own credentials, server id's and ssh key name and all other parameters
|
||||
|
||||
// !!hetznermanager.configure
|
||||
// name:"main"
|
||||
// user:"krist"
|
||||
// whitelist:"2111181, 2392178, 2545053, 2542166, 2550508, 2550378,2550253"
|
||||
// password:"wontsethere"
|
||||
// sshkey:"kristof"
|
||||
!!hetznermanager.configure
|
||||
user:"user_name"
|
||||
whitelist:"server_id"
|
||||
password:"password"
|
||||
sshkey:"ssh_key_name"
|
||||
|
||||
|
||||
// !!hetznermanager.server_rescue
|
||||
// server_name: 'kristof21' // The name of the server to manage (or use `id`)
|
||||
// wait: true // Wait for the operation to complete
|
||||
// hero_install: true // Automatically install Herolib in the rescue system
|
||||
!!hetznermanager.server_rescue
|
||||
server_name: 'server_name' // The name of the server to manage (or use `id`)
|
||||
wait: true // Wait for the operation to complete
|
||||
hero_install: true // Automatically install Herolib in the rescue system
|
||||
|
||||
|
||||
// # Reset a server
|
||||
// !!hetznermanager.server_reset
|
||||
// instance: 'main'
|
||||
// server_name: 'your-server-name'
|
||||
// wait: true
|
||||
!!hetznermanager.server_reset
|
||||
instance: 'main'
|
||||
server_name: 'server_name'
|
||||
wait: true
|
||||
|
||||
// # Add a new SSH key to your Hetzner account
|
||||
// !!hetznermanager.key_create
|
||||
// instance: 'main'
|
||||
// key_name: 'my-laptop-key'
|
||||
// data: 'ssh-rsa AAAA...'
|
||||
!!hetznermanager.key_create
|
||||
instance: 'main'
|
||||
key_name: 'ssh_key_name'
|
||||
data: 'ssh-rsa AAAA...'
|
||||
|
||||
|
||||
// Install Ubuntu 24.04 on a server
|
||||
!!hetznermanager.ubuntu_install
|
||||
server_name: 'kristof2'
|
||||
server_name: 'server_name'
|
||||
wait: true
|
||||
hero_install: true // Install Herolib on the new OS
|
||||
|
||||
@@ -60,9 +60,8 @@ mut n := b.node_new(ipaddr: serverinfo.server_ip)!
|
||||
// this will put hero in debug mode on the system
|
||||
// n.hero_install(compile: true)!
|
||||
|
||||
n.shell('')!
|
||||
|
||||
cl.ubuntu_install(name: name, wait: true, hero_install: true)!
|
||||
n.shell('')!
|
||||
// cl.ubuntu_install(name: 'kristof20', wait: true, hero_install: true)!
|
||||
// cl.ubuntu_install(id:2550378, name: 'kristof21', wait: true, hero_install: true)!
|
||||
// cl.ubuntu_install(id:2550508, name: 'kristof22', wait: true, hero_install: true)!
|
||||
|
||||
Reference in New Issue
Block a user