azvyagintsev | 393dc8e | 2018-11-19 11:31:26 +0200 | [diff] [blame^] | 1 | { |
| 2 | "variables": { |
| 3 | "user": "root", |
| 4 | "password": "ho5uo7Uome5d", |
| 5 | "disk_size": "8000", |
| 6 | "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}", |
| 7 | "ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}", |
| 8 | "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}", |
| 9 | "saltstack_repo": "{{ env `SALTSTACK_REPO` }}", |
| 10 | "do_api_token": "{{ env `DO_API_TOKEN` }}", |
| 11 | "image_name": "{{ env `IMAGE_NAME` }}", |
| 12 | "os_username": "{{ env `OS_USERNAME` }}", |
| 13 | "os_password": "{{ env `OS_PASSWORD` }}", |
| 14 | "os_image": "7451fac0-0ce5-4d30-ae36-cd9a90e7948e", |
| 15 | "os_endpoint": "https://cloud-cz.bud.mirantis.net:5000/v2.0", |
| 16 | "os_zone": "mcp-mk", |
| 17 | "os_floating_ip_pool": "public", |
| 18 | "os_tenant": "26e4dd19485249608ee3685f254f3909", |
| 19 | "os_network": "772f8ca6-1f4a-4535-99d0-880d6ead9a82" |
| 20 | }, |
| 21 | "provisioners": [ |
| 22 | { |
| 23 | "type": "shell", |
| 24 | "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", |
| 25 | "expect_disconnect": "true", |
| 26 | "environment_vars": [ |
| 27 | "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}", |
| 28 | "SALTSTACK_GPG={{ user `saltstack_gpg` }}", |
| 29 | "SALTSTACK_REPO={{ user `saltstack_repo` }}" |
| 30 | ], |
| 31 | "override": { |
| 32 | "virtualbox-iso": { |
| 33 | "scripts": [ |
| 34 | "scripts/base.sh", |
| 35 | "scripts/motd.sh", |
| 36 | "scripts/salt.sh", |
| 37 | "scripts/network.sh", |
| 38 | "scripts/vagrant.sh", |
| 39 | "scripts/virtualbox.sh", |
| 40 | "scripts/security.sh", |
| 41 | "scripts/cleanup.sh", |
| 42 | "scripts/zerodisk.sh" |
| 43 | ] |
| 44 | }, |
| 45 | "vmware-iso": { |
| 46 | "scripts": [ |
| 47 | "scripts/base.sh", |
| 48 | "scripts/motd.sh", |
| 49 | "scripts/salt.sh", |
| 50 | "scripts/vmware.sh", |
| 51 | "scripts/security.sh", |
| 52 | "scripts/cleanup.sh", |
| 53 | "scripts/zerodisk.sh" |
| 54 | ] |
| 55 | }, |
| 56 | "qemu": { |
| 57 | "scripts": [ |
| 58 | "scripts/base.sh", |
| 59 | "scripts/motd.sh", |
| 60 | "scripts/salt.sh", |
| 61 | "scripts/network.sh", |
| 62 | "scripts/security.sh", |
| 63 | "scripts/cleanup.sh", |
| 64 | "scripts/info.sh", |
| 65 | "scripts/zerodisk.sh" |
| 66 | ] |
| 67 | }, |
| 68 | "openstack": { |
| 69 | "scripts": [ |
| 70 | "scripts/base.sh", |
| 71 | "scripts/motd.sh", |
| 72 | "scripts/salt.sh", |
| 73 | "scripts/network.sh", |
| 74 | "scripts/security.sh", |
| 75 | "scripts/cleanup.sh", |
| 76 | "scripts/info.sh", |
| 77 | "scripts/zerodisk.sh" |
| 78 | ] |
| 79 | }, |
| 80 | "docker": { |
| 81 | "scripts": [ |
| 82 | "scripts/docker.sh", |
| 83 | "scripts/base.sh", |
| 84 | "scripts/motd.sh", |
| 85 | "scripts/salt.sh", |
| 86 | "scripts/cleanup.sh" |
| 87 | ] |
| 88 | }, |
| 89 | "digitalocean": { |
| 90 | "scripts": [ |
| 91 | "scripts/base.sh", |
| 92 | "scripts/motd.sh", |
| 93 | "scripts/salt.sh", |
| 94 | "scripts/security.sh", |
| 95 | "scripts/cleanup.sh" |
| 96 | ] |
| 97 | } |
| 98 | } |
| 99 | }, |
| 100 | { |
| 101 | "type": "file", |
| 102 | "source": "files/etc/", |
| 103 | "destination": "/etc" |
| 104 | } |
| 105 | ], |
| 106 | "post-processors": [ |
| 107 | { |
| 108 | "type": "vagrant", |
| 109 | "keep_input_artifact": true, |
| 110 | "output": "images/{{ user `image_name` }}-{{.Provider}}-{{ isotime \"200601021504\" }}.box", |
| 111 | "except": [ |
| 112 | "digitalocean", |
| 113 | "docker" |
| 114 | ] |
| 115 | }, |
| 116 | { |
| 117 | "type": "docker-tag", |
| 118 | "repository": "tcpcloud/ubuntu", |
| 119 | "tag": "16.04", |
| 120 | "only": [ |
| 121 | "docker" |
| 122 | ] |
| 123 | }, |
| 124 | { |
| 125 | "type": "docker-save", |
| 126 | "path": "images/{{ user `image_name` }}-docker-{{ isotime \"200601021504\" }}.tar", |
| 127 | "only": [ |
| 128 | "docker" |
| 129 | ] |
| 130 | } |
| 131 | ], |
| 132 | "builders": [ |
| 133 | { |
| 134 | "type": "virtualbox-iso", |
| 135 | "boot_command": [ |
| 136 | "<esc><wait>", |
| 137 | "<esc><wait>", |
| 138 | "<enter><wait>", |
| 139 | "/install/vmlinuz<wait>", |
| 140 | " auto<wait>", |
| 141 | " console-setup/ask_detect=false<wait>", |
| 142 | " console-setup/layoutcode=us<wait>", |
| 143 | " console-setup/modelcode=pc105<wait>", |
| 144 | " debconf/frontend=noninteractive<wait>", |
| 145 | " debian-installer=en_US<wait>", |
| 146 | " fb=false<wait>", |
| 147 | " initrd=/install/initrd.gz<wait>", |
| 148 | " kbd-chooser/method=us<wait>", |
| 149 | " keyboard-configuration/layout=USA<wait>", |
| 150 | " keyboard-configuration/variant=USA<wait>", |
| 151 | " passwd/root-password={{ user `password` }} ", |
| 152 | " passwd/root-password-again={{ user `password` }} ", |
| 153 | " locale=en_US<wait>", |
| 154 | " netcfg/get_hostname=ubuntu-1604<wait>", |
| 155 | " netcfg/get_domain=cloudlab.cz<wait>", |
| 156 | " noapic<wait>", |
| 157 | " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>", |
| 158 | " -- <wait>", |
| 159 | "<enter><wait>" |
| 160 | ], |
| 161 | "boot_wait": "5s", |
| 162 | "disk_size": "{{ user `disk_size`}}", |
| 163 | "output_directory": "images/{{ user `image_name`}}", |
| 164 | "guest_os_type": "Ubuntu_64", |
| 165 | "http_directory": "http", |
| 166 | "iso_checksum": "10fcd20619dce11fe094e960c85ba4a9", |
| 167 | "iso_checksum_type": "md5", |
| 168 | "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.3-server-amd64.iso", |
| 169 | "ssh_username": "{{ user `user` }}", |
| 170 | "ssh_password": "{{ user `password` }}", |
| 171 | "ssh_port": 22, |
| 172 | "ssh_wait_timeout": "10000s", |
| 173 | "shutdown_command": "shutdown -P now", |
| 174 | "headless": true, |
| 175 | "vboxmanage": [ |
| 176 | [ |
| 177 | "modifyvm", |
| 178 | "{{.Name}}", |
| 179 | "--memory", |
| 180 | "1024" |
| 181 | ], |
| 182 | [ |
| 183 | "modifyvm", |
| 184 | "{{.Name}}", |
| 185 | "--cpus", |
| 186 | "2" |
| 187 | ], |
| 188 | [ |
| 189 | "modifyvm", |
| 190 | "{{.Name}}", |
| 191 | "--vrde", |
| 192 | "on" |
| 193 | ], |
| 194 | [ |
| 195 | "modifyvm", |
| 196 | "{{.Name}}", |
| 197 | "--vrdeport", |
| 198 | "5000-5050" |
| 199 | ], |
| 200 | [ |
| 201 | "modifyvm", |
| 202 | "{{.Name}}", |
| 203 | "--vrdeaddress", |
| 204 | "127.0.0.1" |
| 205 | ] |
| 206 | ] |
| 207 | }, |
| 208 | { |
| 209 | "type": "vmware-iso", |
| 210 | "boot_command": [ |
| 211 | "<esc><wait>", |
| 212 | "<esc><wait>", |
| 213 | "<enter><wait>", |
| 214 | "/install/vmlinuz<wait>", |
| 215 | " auto<wait>", |
| 216 | " console-setup/ask_detect=false<wait>", |
| 217 | " console-setup/layoutcode=us<wait>", |
| 218 | " console-setup/modelcode=pc105<wait>", |
| 219 | " debconf/frontend=noninteractive<wait>", |
| 220 | " debian-installer=en_US<wait>", |
| 221 | " fb=false<wait>", |
| 222 | " initrd=/install/initrd.gz<wait>", |
| 223 | " kbd-chooser/method=us<wait>", |
| 224 | " keyboard-configuration/layout=USA<wait>", |
| 225 | " keyboard-configuration/variant=USA<wait>", |
| 226 | " passwd/root-password={{user `password`}} ", |
| 227 | " passwd/root-password-again={{user `password`}} ", |
| 228 | " locale=en_US<wait>", |
| 229 | " netcfg/get_hostname=ubuntu-1604<wait>", |
| 230 | " netcfg/get_domain=changeme<wait>", |
| 231 | " noapic<wait>", |
| 232 | " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>", |
| 233 | " -- <wait>", |
| 234 | "<enter><wait>" |
| 235 | ], |
| 236 | "boot_wait": "5s", |
| 237 | "disk_size": "{{ user `disk_size`}}", |
| 238 | "disk_type_id": 4, |
| 239 | "vmdk_name": "{{ user `image_name`}}", |
| 240 | "output_directory": "images/{{ user `image_name`}}", |
| 241 | "guest_os_type": "linux", |
| 242 | "http_directory": "http", |
| 243 | "iso_checksum": "10fcd20619dce11fe094e960c85ba4a9", |
| 244 | "iso_checksum_type": "md5", |
| 245 | "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.3-server-amd64.iso", |
| 246 | "ssh_username": "{{user `user`}}", |
| 247 | "ssh_password": "{{user `password`}}", |
| 248 | "ssh_port": 22, |
| 249 | "ssh_wait_timeout": "10000s", |
| 250 | "shutdown_command": "shutdown -P now", |
| 251 | "vmx_data": { |
| 252 | "memsize": "1024", |
| 253 | "numvcpus": "1", |
| 254 | "cpuid.coresPerSocket": "1" |
| 255 | } |
| 256 | }, |
| 257 | { |
| 258 | "type": "docker", |
| 259 | "image": "ubuntu:16.04", |
| 260 | "commit": true |
| 261 | }, |
| 262 | { |
| 263 | "type": "digitalocean", |
| 264 | "api_token": "{{user `do_api_token`}}", |
| 265 | "image": "{{user `image_name`}}", |
| 266 | "snapshot_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}", |
| 267 | "region": "ams2", |
| 268 | "size": "1gb" |
| 269 | }, |
| 270 | { |
| 271 | "type": "qemu", |
| 272 | "qemuargs": [ |
| 273 | [ "-m", "1024M" ], |
| 274 | [ "-cdrom", "config-drive/cloudata.iso" ], |
| 275 | ["-device", "virtio-net,netdev=user.0"], |
| 276 | ["-object","rng-random,id=objrng0,filename=/dev/urandom"], |
| 277 | ["-device", "virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x10" ] |
| 278 | ], |
| 279 | "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}", |
| 280 | "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}", |
| 281 | "format": "qcow2", |
| 282 | "iso_checksum": "566efef1d6f12e7d3a994c2405bdb642", |
| 283 | "iso_checksum_type": "md5", |
| 284 | "iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img", |
| 285 | "iso_target_path": "{{ user `images_cache`}}/release-20180306_xenial-server-cloudimg-amd64-disk1.img", |
| 286 | "disk_image": true, |
| 287 | "disk_compression": true, |
| 288 | "accelerator": "kvm", |
| 289 | "disk_size": "{{ user `disk_size`}}", |
| 290 | "headless": true, |
| 291 | "ssh_username": "{{ user `user` }}", |
| 292 | "ssh_password": "{{ user `password` }}", |
| 293 | "ssh_host_port_min": 7000, |
| 294 | "ssh_host_port_max": 7050, |
| 295 | "shutdown_command": "shutdown -P now", |
| 296 | "boot_wait": "2s", |
| 297 | "ssh_wait_timeout": "360s" |
| 298 | }, |
| 299 | { |
| 300 | "type": "openstack", |
| 301 | "ssh_username": "{{user `user`}}", |
| 302 | "ssh_password": "{{user `password`}}", |
| 303 | "image_name": "{{user `image_name`}}", |
| 304 | "floating_ip_pool": "{{user `os_floating_ip_pool`}}", |
| 305 | "reuse_ips": "true", |
| 306 | "source_image": "{{ user `os_image` }}", |
| 307 | "flavor": "{{ user `os_flavor` }}", |
| 308 | "user_data_file": "config-drive/user-data.yaml", |
| 309 | "tenant_id": "{{ user `os_tenant` }}", |
| 310 | "networks": ["{{ user `os_network` }}"], |
| 311 | "availability_zone": "{{user `os_zone`}}", |
| 312 | "identity_endpoint": "{{user `os_endpoint`}}", |
| 313 | "username": "{{user `os_username`}}", |
| 314 | "password": "{{user `os_password`}}" |
| 315 | } |
| 316 | ] |
| 317 | } |