- Print
- PDF
Packer
- Print
- PDF
Available in Classic and VPC
Packer is a server image creation automation tool provided in Hashicorp. You can use Packer to conveniently create server images by entering commands, unlike the previous process of manually creating server images.
Packer is developing a customized builder in plugin format, and has a plugin exclusively for NAVER Cloud Platform. NAVER Cloud Platform users can use the exclusive plugin to easily make server images.
Download the Packer execution files from the Packer website.
JSON template
To use Packer, you need a JSON file that defines the properties needed for running commands. An example of a JSON file used in NAVER Cloud Platform is as follows:
{
"variables": {
"ncloud_access_key": "FRxhOQRNjKVMqIz0sRLY",
"ncloud_secret_key": "xd6kTO5iNcLookBx0D8TDKmpLj8ikxqEhc06MQD2"
},
"builders": [
{
"type": "ncloud",
"access_key": "{{user `ncloud_access_key`}}",
"secret_key": "{{user `ncloud_secret_key`}}",
"server_image_product_code": "SPSW0LINUX000046",
"server_product_code": "SPSVRSSD00000002",
"server_image_name": "packertest",
"server_image_description": "server image description",
"region": "Korea"
}
]
}
For descriptions for each item, see the builder webpage for NAVER Cloud Platform.
Windows server image requirements
The code that must be included when you create a Windows server image is as follows:
"builders": [
{
"type": "ncloud",
...
"user_data":
"CreateObject(\"WScript.Shell\").run(\"cmd.exe /c powershell Set-ExecutionPolicy RemoteSigned & winrm set winrm/config/service/auth @{Basic=\"\"true\"\"} & winrm set winrm/config/service @{AllowUnencrypted=\"\"true\"\"} & winrm quickconfig -q & sc config WinRM start= auto & winrm get winrm/config/service\")",
"communicator": "winrm",
"winrm_username": "Administrator"
}
],
"provisioners": [
{
"type": "powershell",
"inline": [
"$Env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /shutdown /quiet /mode:vm \"/unattend:C:\\Program Files (x86)\\NBP\\nserver64.xml\" "
]
}
]
- You can create public IP addresses up to the number of server instances you possess. Take precautions so that the number of possessed public IP addresses does not exceed the number of server instances (including those to be used for creating server images) before running Packer.
- If you cannot proceed with the Packer process any longer due to force stopping of the Packer process or ending of the terminal program, the resources may not be organized. In this case, the user must manually organize the resources themselves.