Learn about fully automating OS installation or reinstallation on a dedicated server with the OVHcloud API.
Requirements
- a dedicated server in your OVHcloud account
- access to the OVHcloud API
Instructions
OS Compatibility
Log in to the API console and go to the /dedicated/server
section.
You can list all your dedicated servers with the following API call:
To list all compatible OSs for a specific dedicated server, you can use the following API call:
GET /dedicated/server/{serviceName}/install/compatibleTemplates
In the response, look at the contents of the ovh
key: this is the list of OSs in the OVHcloud catalog that you can install on this server.
OS details information
In the /dedicated/installationTemplate
section, you can display the details for a specific OS:
GET /dedicated/installationTemplate/{templateName}
The response will show information such as:
Attribute | Description |
---|---|
distribution | OS Name |
description | OS Display Name |
endOfInstall | OVHcloud OS end of availability date¹ |
usage,category,family | Usage, category, and OS family |
project/os | Information about OS governance, version, release notes, and project URL |
project/usage | Same as project/os, but at the software layer if applicable |
license/os | Information about OS license: licensing contract URL and licensing type |
license/usage | Same as license/os, but at the software layer if applicable |
filesystems | Compatible file systems types |
hardRaidConfiguration, softRaidOnlyMirroring,lvmReady | Compatibility with hardware raids, software raids, and LVM² |
inputs | OS-specific questions (see explanation below) |
¹ Customers that don't use images from the OVHcloud catalog (installation from a custom image (BYOI/BYOLinux), installation over the network, or manually via IPMI) are not affected by this limitation.
² For more details, see partitioning customization.
OS Questions
Some OSs can have a list of specific questions. If that is the case, the inputs
key contains a list of questions.
Example of specific questions for Debian 12 (Bookworm):
Example of specific questions for Windows Server 2022 Standard (Core):
Each question has the following attributes:
Attribute | Description |
---|---|
default | If no answer is provided, this value will be used |
mandatory | If this question is mandatory¹ |
type | Value type expected in the answer |
name | Question name (used as identifier) |
description | Question description |
enum | Possible values (only applicable for enum type ) |
¹ If a mandatory question without default value is not answered, the API will return an error.
Disk Groups
Some dedicated servers have multiple groups of disks. For example, one group with SATA disks and another group with SSD disks. Those servers are sometimes also called hybrid servers.
To list the disk groups and their disks, you can use the following API call to identify the disk group on which you want the OS to be installed:
GET /dedicated/server/{serviceName}/specifications/hardware
Example reply:
In this example, there are two disk groups:
- the first one (diskGroupId=1) contains 2 x 480 GB disks.
- the second one (diskGroupId=2) contains 2 x 1.9 TB disks.
Create an OS installation task
When you have gathered all the information that you need, you can create the OS installation task with the following API call:
POST /dedicated/server/{serviceName}/install/start
With the following parameters:
Parameter | Value | Required |
---|---|---|
serviceName | Server name | ✅ |
templateName | OS to install | ✅ |
diskGroupId | Id of the disk group on which the OS will be installed | ❌ |
customHostname | Custom hostname | ❌ |
userMetadata | Answers to the OS-specific questions | ❌ |
userMetadata
contains a list of key/value with the answers to the OS-specific questions:
- Key must be the
name
of the question. - Value must be the answer to the question, in the requested
type
.
Linux payload example
The following payload will install Debian 12 (Bookworm) with SSH key-based authentication and a custom bash post-installation script:
Even though the post-installation script could be sent to API directly in clear text by escaping special characters, it is recommended to send a base64-encoded script to the API. You can use the following UNIX/Linux command to encode your script:
Here is the clear-text post-installation bash script from the example above:
Windows payload example
The following payload will install Windows Server 2022 Standard (Core) with a custom PowerShell post-installation script.
Even though the post-installation script could be sent to API directly in clear text by escaping special characters, it is recommended to send a base64 encoded script to the API. You can use the following PowerShell command to encode your script:
Here is the clear-text post-installation PowerShell script from the example above:
As you can see, this PowerShell script for Windows is equivalent to the previous bash script for Linux.
cmd
value to key postInstallationScriptExtension
in the userMetadata
payload.While running the Windows post-installation script, the following files will remain:
- The script itself:
c:\ovhupd\script\custrun.ps1
(orc:\ovhupd\script\custrun.cmd
if batch script). - Log file:
c:\ovhupd\script\customerscriptlog.txt
.
Administrator
local account. You can finish your script with a shutdown /l
command to log off the Windows session, although the Administrator
local account is locked and cannot be accessed remotely (via RDP connection).Example reply:
123456789
is the OS installation task ID. You can follow the OS installation task status with the following API call:
GET /dedicated/server/{serviceName}/task/{taskId}
You can also monitor the progress of the installation process with the following API call which displays a detailed list of steps:
GET /dedicated/server/{serviceName}/install/status
Go further
For more information and tutorials, please see our other Dedicated Servers support guides or explore the guides for other OVHcloud products and services.