创建适用于 kvm 的配置文件

创建适用于 kvm 的配置文件


开始

{

"_comment": "Basic templates for packer,Build with `packer build -var-file variables-centos7.9.json centos.json`",

"builders": [

{

"type": "qemu",

"vm_name": "{{user `default_vm_name`}}",

"iso_checksum": "{{user `iso_checksum`}}",

"iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}",

"http_directory": "{{user `http_directory`}}",

"output_directory": "{{user `build_directory`}}/packer-{{user `default_vm_name`}}-qemu",

"headless": "{{user `headless`}}",

"shutdown_command": "sudo /sbin/halt -h -p",

"cpus": "{{user `cpus`}}",

"memory": "{{user `memory`}}",

"disk_size": "{{user `disk_size`}}",

"format": "qcow2",

"accelerator": "kvm",

"net_device": "virtio-net",

"disk_interface": "virtio",

"ssh_port": 22,

"ssh_timeout": "30m",

"ssh_username": "{{user `ssh_username`}}",

"ssh_password": "{{user `ssh_password`}}",

"boot_command": [

"<up><wait><tab> text ks=http://{{.HTTPIP}}:{{.HTTPPort}}/{{user `ks_path`}} PACKER_AUTHORIZED_KEY=http://{{.HTTPIP}}:{{.HTTPPort}}/{{user `ssh_pubkey`}} <enter><wait>"

],

"boot_wait": "5s",

"qemuargs": [

[ "-m", "1024M" ]

]

}

],

"sensitive-variables": [

"ssh_password",

"ssh_pubkey"

],

"provisioners": [

{

"execute_command": "{{.Vars}} sudo -E sh -eux '{{.Path}}'",

"expect_disconnect": true,

"scripts": [

"{{pwd}}/scripts/base.sh",

"{{pwd}}/scripts/cleanall.sh"

],

"type": "shell"

}

],

"post-processors": [

{

"type": "vagrant",

"output": "{{user `build_directory`}}/{{user `box_basename`}}.{{.Provider}}-kvm.box",

"vagrantfile_template": "{{pwd}}/../_common/for_packer/Vagrantfile",

"include": "{{pwd}}/../_common/for_packer/metadata.json"

}

]

}
上次更新:
贡献者: iEchoxu