Install the OS by auto-installation
The automatic installation of the OS will delete data on all disks.
We recommend that you save your data or create a backup before installing the OS.
You can install the OS through Terraform only by auto-installation. Automatic OS installation is available only for servers of ready configuration without upgrade. You can install the OS manually from your image on a ready configuration server with an upgrade.
You can install an OS on the server that is different from the current OS or reinstall the current OS.
Install a new OS
Reinstall the OS
-
Open the CLI.
-
Make sure you are in the directory with the configuration file.
-
Specify the desired OS in the
selectel_dedicated_os_v1data source:data "selectel_dedicated_os_v1" "server_os" {
project_id = selectel_vpc_project_v2.project_1.id
filter {
name = "<os_image_name>"
version_name = "<version_name>"
configuration_id = data.selectel_dedicated_configuration_v1.server_config.configurations[0].id
location_id = data.selectel_dedicated_location_v1.server_location.locations[0].id
}
}Specify:
<os_image_name>- OS family name, e.g.Ubuntu;<version_name>- OS version, e.g.22.04. The OS version can be viewed in the table Standard OS images or by using the List OS configurations via Dedicated Servers API.
-
Check that the configuration file has been compiled without errors:
terraform validate -
Format the configuration file:
terraform fmt -
Check the changes:
terraform plan -
Apply the changes:
terraform apply -
Confirm the creation - type yes and press Enter. The changes will be displayed in the control panel.
-
Wait for the OS installation to complete.
-
Open the CLI.
-
Make sure you are in the directory with the configuration file.
-
In the configuration file, add the
force_update_additional_paramsparameter to theselectel_dedicated_server_v1resource with a value oftrue:resource "selectel_dedicated_server_v1" "server_1" {
project_id = selectel_vpc_project_v2.project_1.id
configuration_id = data.selectel_configuration_v1.server_config.configurations[0].id
location_id = data.selectel_location_v1.server_location.locations[0].id
price_plan_name = "1 day"
public_subnet_id = data.selectel_public_subnet_v1.subnets.subnets[0].id
os_id = data.selectel_os_v1.server_os.os[0].id
os_host_name = "Turing"
os_password = "Passw0rd!"
force_update_additional_params = true
} -
Change the value of any additional parameter for
os_id:os_password,user_data,ssh_key,ssh_key_name,partitions_config,os_host_name:resource "selectel_dedicated_server_v1" "server_1" {
project_id = selectel_vpc_project_v2.project_1.id
configuration_id = data.selectel_configuration_v1.server_config.configurations[0].id
location_id = data.selectel_location_v1.server_location.locations[0].id
price_plan_name = "1 day"
public_subnet_id = data.selectel_public_subnet_v1.subnets.subnets[0].id
os_id = data.selectel_os_v1.server_os.os[0].id
force_update_additional_params = true
os_host_name = "new_Turing"
os_password = "new_Passw0rd!"
}Here
os_host_name,os_passwordare additional OS parameters. See the detailed description of the selectel_dedicated_server_v1 resource. -
Check that the configuration file has been compiled without errors:
terraform validate -
Format the configuration file:
terraform fmt -
Check the changes:
terraform plan -
Apply the changes:
terraform apply -
Confirm the creation - type yes and press Enter. The changes will be displayed in the control panel.
-
Wait for the OS installation to complete.
-
In the configuration file, delete the
force_update_additional_paramsparameter in theselectel_dedicated_server_v1resource that you added in step 3. -
Check that the configuration file has been compiled without errors:
terraform validate -
Format the configuration file:
terraform fmt -
Check the changes:
terraform plan -
Apply the changes:
terraform apply