Chuyển tới nội dung chính

User data

User data or Cloud-init automatically configures Bare Metal GPU servers after bootup. These scripts are generally used for the initial configuration of a server and run on the first boot.

Deploying a server with user data allows you to run arbitrary commands and change several aspects of the server during provisioning.

Here are a few examples of what you can do with user data scripts:

Creating a user and installing basic packages

#cloud-config users: - name: cloud_user ssh_authorized_keys: - ssh-rsa AAAAB3Nz... user@domain sudo: "ALL=(ALL) NOPASSWD:ALL" groups: sudo shell: /bin/bash packages: - git - htop

What this script does:

  1. Creates a user named cloud_user.
  2. Adds an SSH key to allow secure remote login.
  3. Installs packages like git (a version control tool) and htop (a system monitor).

How you can test it:

To login, you’ll want to use a command of this form:

ssh -i /.ssh/id_rsa maas_user@10.192.226.195

You can then test it further by running htop and trying out some git commands.

Setting up SSH keys for multiple users

#cloud-config users: - default - name: user1 ssh_authorized_keys: - ssh-rsa AAAAB3Nz... user1@domain - name: user2 ssh_authorized_keys: - ssh-rsa AAAAB3Nz... user2@domain

What this script does:

  1. Sets up a default user.
  2. Creates user1 and user2 with their own SSH keys for secure login.

Installing Docker

#cloud-config packages: - docker.io runcmd: - systemctl enable docker - systemctl start docker

What this script does:

  1. Installs Docker on the machine.
  2. Enables and starts Docker to make sure it’s running whenever the machine boots up.

Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the ask query parameter:

GET https://ai-docs.fptcloud.com/fpt-gpu-cloud/metal-cloud/tutorials/cccess-servers.md?ask=<question>

The question should be specific, self-contained, and written in natural language. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.