azvyagintsev | 9a1737f | 2019-03-11 15:44:54 +0200 | [diff] [blame^] | 1 | { |
| 2 | "variables": { |
| 3 | "user": "root", |
| 4 | "password": "r00tme", |
| 5 | "disk_size": "10000", |
| 6 | "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}", |
| 7 | "mirror_hostname": "{{ env `MIRROR_HOSTNAME` }}", |
| 8 | "mirror_directory": "{{ env `MIRROR_DIRECTORY` }}", |
| 9 | "ubuntu_baseurl": "http://{{ env `MIRROR_HOSTNAME`}}/{{ env `MIRROR_DIRECTORY` }}/", |
| 10 | "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}", |
| 11 | "saltstack_repo": "{{ env `SALTSTACK_REPO` }}", |
| 12 | "do_api_token": "{{ env `DO_API_TOKEN` }}", |
| 13 | "image_name": "{{ env `IMAGE_NAME` }}" |
| 14 | }, |
| 15 | "provisioners": [ |
| 16 | { |
| 17 | "type": "shell-local", |
| 18 | "command": "cp -av ../common/files/scripts/growlvm.py files/scripts/growlvm.py" |
| 19 | }, |
| 20 | { |
| 21 | "type": "shell", |
| 22 | "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }};", |
| 23 | "expect_disconnect": "true", |
| 24 | "environment_vars": [ |
| 25 | "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}", |
| 26 | "SALTSTACK_GPG={{ user `saltstack_gpg` }}", |
| 27 | "SALTSTACK_REPO={{ user `saltstack_repo` }}" |
| 28 | ], |
| 29 | "override": { |
| 30 | "qemu": { |
| 31 | "scripts": [ |
| 32 | "scripts/base.sh", |
| 33 | "scripts/motd.sh", |
| 34 | "scripts/salt.sh", |
| 35 | "scripts/network.sh", |
| 36 | "scripts/security.sh", |
| 37 | "scripts/cleanup.sh", |
| 38 | "scripts/info.sh", |
| 39 | "scripts/zerodisk.sh" |
| 40 | ] |
| 41 | } |
| 42 | } |
| 43 | }, |
| 44 | { |
| 45 | "type": "file", |
| 46 | "source": "files/etc/", |
| 47 | "destination": "/etc" |
| 48 | }, |
| 49 | { |
| 50 | "type": "file", |
| 51 | "source": "files/scripts/", |
| 52 | "destination": "/usr/bin" |
| 53 | } |
| 54 | ], |
| 55 | "builders": [ |
| 56 | { |
| 57 | "type": "qemu", |
| 58 | "qemuargs": [ |
| 59 | ["-m", "2048M"] |
| 60 | ], |
| 61 | "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}.qcow2", |
| 62 | "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}", |
| 63 | "disk_compression": true, |
| 64 | "disk_size": "{{ user `disk_size`}}", |
| 65 | "accelerator": "kvm", |
| 66 | "iso_checksum": "34416ff83179728d54583bf3f18d42d2", |
| 67 | "iso_checksum_type": "md5", |
| 68 | "iso_url": "http://cdimage.ubuntu.com/ubuntu/releases/bionic/release/ubuntu-18.04.2-server-amd64.iso", |
| 69 | "iso_target_path": "{{ user `images_cache` }}/ubuntu-18.04.2-server-amd64.iso", |
| 70 | "http_directory": "http", |
| 71 | "headless": true, |
| 72 | "ssh_username": "{{user `user`}}", |
| 73 | "ssh_password": "{{user `password`}}", |
| 74 | "shutdown_command": "sync; sudo /sbin/shutdown -hP now", |
| 75 | "boot_wait": "2s", |
| 76 | "ssh_timeout": "20m", |
| 77 | "ssh_host_port_min": 7050, |
| 78 | "ssh_host_port_max": 7060, |
| 79 | "vnc_port_min": 5930, |
| 80 | "vnc_port_max": 5930, |
| 81 | "boot_command": [ |
| 82 | "<esc><down><wait><f6><esc><wait>", |
| 83 | "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", |
| 84 | "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", |
| 85 | "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", |
| 86 | "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", |
| 87 | "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", |
| 88 | "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", |
| 89 | "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", |
| 90 | "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", |
| 91 | "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", |
| 92 | " initrd=/install/hwe-initrd.gz", |
| 93 | " edd=on nodmraid nomodeset acpi=off", |
| 94 | " console-setup/ask_detect=false", |
| 95 | " console-setup/layoutcode=us", |
| 96 | " console-setup/modelcode=pc105", |
| 97 | " debconf/frontend=noninteractive", |
| 98 | " debian-installer=en_US", |
| 99 | " fb=false", |
| 100 | " kbd-chooser/method=us", |
| 101 | " keyboard-configuration/layout=USA", |
| 102 | " keyboard-configuration/variant=USA", |
| 103 | " netcfg/get_hostname=ubuntu netcfg/get_domain=local", |
| 104 | " locale=en_US", |
| 105 | " mirror/http/hostname={{ user `mirror_hostname` }} mirror/http/directory={{ user `mirror_directory` }}", |
| 106 | " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg --- ", |
| 107 | "<enter><wait>" |
| 108 | ] |
| 109 | } |
| 110 | ] |
| 111 | } |