chore: add current provisioning state before migration
This commit is contained in:
parent
a9703b4748
commit
50745b0f22
660 changed files with 88126 additions and 0 deletions
28
.provisioning/extensions/providers/digitalocean/hooks/notify-created.nu
Executable file
28
.provisioning/extensions/providers/digitalocean/hooks/notify-created.nu
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
# Post-server-create hook for DigitalOcean
|
||||
# Sends notifications after server creation
|
||||
|
||||
def main [context: string] {
|
||||
let ctx = ($context | from json)
|
||||
|
||||
print $"📡 Sending notification for DigitalOcean server creation..."
|
||||
|
||||
# Extract server info from context
|
||||
let servers = ($ctx | get -o servers | default [])
|
||||
|
||||
$servers | each {|server|
|
||||
print $"✅ Server created: ($server.hostname) in ($server.region)"
|
||||
|
||||
# Here you could send to Slack, Discord, email, etc.
|
||||
# Example: webhook notification
|
||||
# http post $webhook_url { server: $server.hostname, status: "created" }
|
||||
}
|
||||
|
||||
# Output notification results
|
||||
{
|
||||
provider: "digitalocean"
|
||||
notification: "sent"
|
||||
servers_notified: ($servers | length)
|
||||
} | to json
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
# Pre-server-create hook for DigitalOcean
|
||||
# Validates credentials and prerequisites
|
||||
|
||||
def main [context: string] {
|
||||
let ctx = ($context | from json)
|
||||
|
||||
print "🔍 Validating DigitalOcean credentials..."
|
||||
|
||||
# Check if API token is set
|
||||
if ($env.DO_API_TOKEN? | is-empty) {
|
||||
print "❌ DO_API_TOKEN environment variable not set"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if doctl is installed
|
||||
if (which doctl | length) == 0 {
|
||||
print "❌ doctl CLI not found. Install from: https://github.com/digitalocean/doctl"
|
||||
exit 1
|
||||
}
|
||||
|
||||
print "✅ DigitalOcean credentials and tools validated"
|
||||
|
||||
# Output validation results
|
||||
{
|
||||
provider: "digitalocean"
|
||||
validation: "passed"
|
||||
checks: {
|
||||
api_token: true
|
||||
doctl_installed: true
|
||||
}
|
||||
} | to json
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue