...
This commit is contained in:
@@ -38,7 +38,7 @@ fn do() ! {
|
||||
|
||||
if os.args.len == 2 {
|
||||
mypath := os.args[1]
|
||||
if mypath.to_lower().ends_with('.hero') {
|
||||
if mypath.to_lower().ends_with('.hero') || mypath.to_lower().ends_with('.heroscript') || mypath.to_lower().ends_with('.hs') {
|
||||
// hero was called from a file
|
||||
playcmds_do(mypath)!
|
||||
return
|
||||
@@ -94,7 +94,7 @@ fn do() ! {
|
||||
|
||||
fn main() {
|
||||
do() or {
|
||||
$dbg;
|
||||
// $dbg;
|
||||
eprintln('Error: ${err}')
|
||||
print_backtrace()
|
||||
exit(1)
|
||||
|
||||
34
examples/virt/hetzner/hetzner_example.hero
Executable file
34
examples/virt/hetzner/hetzner_example.hero
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env hero
|
||||
|
||||
|
||||
// !!hetznermanager.configure
|
||||
// name:"main"
|
||||
// user:"krist"
|
||||
// whitelist:"2111181, 2392178, 2545053, 2542166, 2550508, 2550378,2550253"
|
||||
// password:"wontsethere"
|
||||
// sshkey:"kristof"
|
||||
|
||||
|
||||
!!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
|
||||
|
||||
// # Install Ubuntu 24.04 on a server
|
||||
// !!hetznermanager.ubuntu_install
|
||||
// instance: 'main'
|
||||
// id: 1234567 // The ID of the server (or use `server_name`)
|
||||
// wait: true
|
||||
// hero_install: true // Install Herolib on the new OS
|
||||
|
||||
// # Reset a server
|
||||
// !!hetznermanager.server_reset
|
||||
// instance: 'main'
|
||||
// server_name: 'your-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...'
|
||||
@@ -17,20 +17,22 @@ passwd := os.environ()['HETZNER_PASSWORD'] or {
|
||||
exit(1)
|
||||
}
|
||||
|
||||
playcmds.run(
|
||||
heroscript: '
|
||||
!!hetznermanager.configure
|
||||
name:"main"
|
||||
user:"${user}"
|
||||
whitelist:"2111181, 2392178, 2545053, 2542166, 2550508, 2550378,2550253"
|
||||
password:"${passwd}"
|
||||
sshkey:"kristof"
|
||||
'
|
||||
)!
|
||||
hs:='
|
||||
!!hetznermanager.configure
|
||||
user:"${user}"
|
||||
whitelist:"2111181, 2392178, 2545053, 2542166, 2550508, 2550378,2550253"
|
||||
password:"${passwd}"
|
||||
sshkey:"kristof"
|
||||
'
|
||||
|
||||
println(hs)
|
||||
|
||||
playcmds.run(heroscript: hs)!
|
||||
|
||||
|
||||
console.print_header('Hetzner Test.')
|
||||
|
||||
mut cl := hetznermanager.get(name: 'main')!
|
||||
mut cl := hetznermanager.get()!
|
||||
// println(cl)
|
||||
|
||||
// for i in 0 .. 5 {
|
||||
|
||||
@@ -95,7 +95,6 @@ fn cmd_bootstrap_execute(cmd Command) ! {
|
||||
if develop {
|
||||
// n.crystal_install(reset: reset)!
|
||||
n.hero_install()!
|
||||
n.dagu_install()!
|
||||
} else {
|
||||
panic('implement, need to download here and install')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user