Ga naar inhoud

Gebruik van Cloud-init-scripts

Bij het bestellen van een nieuwe server of het opnieuw installeren van een besturingssysteem kunt u Cloud-init-scripts gebruiken voor automatische serverconfiguratie. Met deze functie kunt u de initiële systeemconfiguratie direct na de installatie van het besturingssysteem automatiseren.

Het veld Cloud init script bevindt zich in de sectie Advanced options wanneer u:

  • Een nieuwe server bestelt;
  • Het besturingssysteem opnieuw installeert.

Let op

Het veld verschijnt pas nadat u een besturingssysteem heeft geselecteerd.

Scriptformaat

Het Cloud-init-script moet in YAML-formaat worden geschreven, met inachtneming van de volgende vereisten:

  • Strikte inspringing (gebruik spaties, geen tabbladen);
  • Begin met de directive #cloud-config;
  • Volg de YAML-syntaxis.

Voorbeeldscript

#cloud-config
users:
  - name: demo
    ssh-authorized-keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCv60WjxoM39LgPDbiW7ne3gu18q0NIVv0RE6rDLNal1quXZ3nqAlANpl5qmhDQ+GS/sOtygSG4/9aiOA4vXO54k1mHWL2irjuB9XbXr00+44vSd2q/vtXdGXhdSMTf4/XK17fjKSG/9y3yD6nml6q9XgQxx9Vf/IkaKdlK0hbC1ds0+8h83PTb9dF3L7hf3Ch/ghvj5++tWJFdFeG+VI7EDuKNA4zL8C5FdYYWFA88YAmM8ndjA5qCjZXIIeZvZ/z9Kpy6DL0QZ8T3NsxRKapEU3nyiIuEAmn8fbnosWcsovw0IS1Hz6HsjYo4bu/gA82LWt3sdRUBZ/7ZsVD3ELip [email protected]

Gebruiksaanwijzing

  1. Selecteer het besturingssysteem;
  2. Vouw de sectie Advanced options uit;
  3. Voer uw YAML-script in het veld Cloud init script in;
  4. Zorg voor correcte inspringing en syntaxis;
  5. Ga verder met het bestel- of herinstallatieproces.

Let op

Het is van cruciaal belang om de correcte inspringing in YAML-formaat te behouden! Zonder correcte inspringing werkt het script niet correct.

Mogelijkheden van Cloud-init

Met Cloud-init-scripts kunt u: - Gebruikers en groepen aanmaken; - SSH-sleutels configureren; - Pakketten installeren; - Netwerkinterfaces configureren; - Willekeurige opdrachten uitvoeren bij het eerste opstarten; - Extra schijven mounten.

Informatie

Gedetailleerde documentatie over Cloud-init is te vinden op de officiële website.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×