Commit 37393fe4 authored by Łukasz Nowak's avatar Łukasz Nowak

Update packer usage

See merge request !148
parents e5681ab8 9594ef10
......@@ -14,8 +14,8 @@ How to build one VM?
mkdir /opt/packer/
cd /opt/packer/
wget https://releases.hashicorp.com/packer/0.10.1/packer_0.10.1_linux_amd64.zip
unzip packer_0.10.1_linux_amd64.zip
wget https://releases.hashicorp.com/packer/1.7.3/packer_1.7.3_linux_amd64.zip
unzip packer_1.7.3_linux_amd64.zip
2) Building one VM (example)::
......
......@@ -12,8 +12,8 @@ How to build VM with differents images size?
mkdir /opt/packer/
cd /opt/packer/
wget https://releases.hashicorp.com/packer/0.10.1/packer_0.10.1_linux_amd64.zip
unzip packer_0.10.1_linux_amd64.zip
wget https://releases.hashicorp.com/packer/1.7.3/packer_1.7.3_linux_amd64.zip
unzip packer_1.7.3_linux_amd64.zip
2) Check and install qemu
......
{
"variables": {
"user": "slapos",
"password": "slapos",
"domain": "",
"disk_size": "100",
"name": "image",
"custom_script": "scripts/empty.sh"
},
"builders":
[
"builders": [
{
"name": "debian10-{{ user `disk_size`}}G-{{ user `name`}}",
"type": "qemu",
"format": "qcow2",
"accelerator": "kvm",
"disk_size": "{{ user `disk_size`}}000",
"iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.2.0-amd64-netinst.iso",
"iso_checksum": "36de671429939e90f2a31ce3fbed0aaf",
"iso_checksum_type": "md5",
"http_directory": "http",
"ssh_username": "{{user `user`}}",
"ssh_password": "{{user `password`}}",
"ssh_wait_timeout": "1800s",
"shutdown_command": "echo '{{user `password`}}'|sudo -S shutdown -h now",
"headless": true,
"boot_wait": "2s",
"boot_command": [
"<esc><wait><wait><wait><wait>",
"auto preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed-debian10.cfg ",
"debian-installer=en_US.UTF-8 locale=en_US keymap=fr ",
"netcfg/get_hostname={{ .Name }} ",
"netcfg/get_domain={{ user `domain`}} ",
"fb=false debconf/frontend=noninteractive ",
"passwd/user-fullname={{user `user`}} ",
"passwd/user-password={{user `password`}} ",
"passwd/user-password-again={{user `password`}} ",
"passwd/username={{user `user`}} ",
"<enter>"
]
],
"boot_wait": "2s",
"disk_size": "{{ user `disk_size`}}000",
"format": "qcow2",
"headless": true,
"http_directory": "http",
"iso_checksum": "md5:a3ebc76aec372808ad80000108a2593a",
"iso_url": "https://shacache.nxdcdn.com/0a6aee1d9aafc1ed095105c052f9fdd65ed00ea9274188c9cd0072c8e6838ab40e246d45a1e6956d74ef1b04a1fc042151762f25412e9ff0cbf49418eef7992e",
"name": "debian10-{{ user `disk_size`}}G-{{ user `name`}}",
"shutdown_command": "echo '{{user `password`}}'|sudo -S shutdown -h now",
"ssh_password": "{{user `password`}}",
"ssh_timeout": "3600s",
"ssh_username": "{{user `user`}}",
"type": "qemu"
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo '{{user `password`}}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"scripts": [
"scripts/update.sh",
......@@ -60,8 +39,17 @@
"scripts/network-debian.sh",
"scripts/cleanup.sh",
"{{ user `custom_script` }}"
]
],
"type": "shell"
}
],
"variables": {
"custom_script": "scripts/empty.sh",
"disk_size": "100",
"domain": "",
"name": "image",
"password": "slapos",
"user": "slapos"
}
]
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment