Digitalocean

Verwalten Sie die Digitalocean Cloud mit Salt

SSH Schlüsselpaar erzeugen

mkdir /etc/salt/cloud.keys.d 
ssh-keygen -N "" -t ed25519 -C "salt@digitalocean" \ 
-f /etc/salt/cloud.keys.d/digitalocean

Account vorbereiten

Erzeugen Sie einen API-Token. Klicken Sie im linken Menü den Bereich »API« an.

Hinterlegen Sie den zuvor erzeugen öffentlichen Schlüssel. Dazu wählen Sie auf der linken Seite den Menüpunkt »Settings« aus.

Konfigurationsdateien anlegen

Cloud Provider

/etc/salt/cloud.providers.d/digitalocean.conf
digitalocean:
  driver: digitalocean
  personal_access_token: <TOKEN>
  ssh_key_file: /etc/salt/cloud.keys.d/digitalocean
  ssh_key_names: salt # Must match the name of your SSH pub key
  location: Frankfurt 1
  minion:
    master: <MASTER-IP-OR-FQDN>
    master_port: <MASTER-PORT>    # omit to use default 4506
    publish_port: <PUBLISH-PORT>  # omit to use default 4505
    # Make connection more fault tolerant
    tcp_keepalive_idle: 60
    tcp_keepalive_cnt: 2
    tcp_keepalive_intvl: 60

Testen Sie mit salt-cloud --list-images digitalocean, ob die Konfiguration funktioniert

Cloud Profile

/etc/salt/cloud.profiles.d/digitalocean.conf
ubuntu-s@do:
  provider: digitalocean
  image: 22.04 (LTS) x64
  size: s-1vcpu-1gb
  private_networking: False
  backups_enabled: False
  ipv6: True
  create_dns_record: False

VM verwalten

Legen Sie nun eine neue VM an

salt-cloud -p ubuntu-s@do umar -l debug
salt umar test.ping

VM können mit salt-cloud -d <MINION-ID> wieder gelöscht werden.

Last updated