Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 1 | { |
| 2 | "variables": { |
| 3 | "user": "root", |
| 4 | "password": "r00tme", |
azvyagintsev | 0f697cf | 2018-06-22 11:44:13 +0300 | [diff] [blame] | 5 | "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}", |
| 6 | "disk_size": "50000", |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 7 | "do_api_token": "{{ env `DO_API_TOKEN` }}", |
| 8 | "image_name": "{{ env `IMAGE_NAME` }}", |
Jiri Broulik | 3ffb745 | 2018-04-12 10:37:07 +0200 | [diff] [blame] | 9 | "cluster_model": "{{ env `CLUSTER_MODEL` }}", |
| 10 | "cluster_model_ref": "{{ env `CLUSTER_MODEL_REF` }}", |
| 11 | "cluster_name": "{{ env `CLUSTER_NAME` }}", |
azvyagintsev | ffa75b4 | 2018-06-06 20:38:54 +0300 | [diff] [blame] | 12 | "bs_hostname": "cfg01", |
Jiri Broulik | 3ffb745 | 2018-04-12 10:37:07 +0200 | [diff] [blame] | 13 | "mcp_version": "{{ env `MCP_VERSION` }}", |
| 14 | "ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}", |
| 15 | "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}", |
| 16 | "saltstack_repo": "{{ env `SALTSTACK_REPO` }}", |
| 17 | "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_GPG` }}", |
| 18 | "apt_mirantis_salt_repo": "{{ env `APT_MIRANTIS_SALT_REPO` }}", |
| 19 | "git_salt_formulas_scripts": "{{ env `GIT_SALT_FORMULAS_SCRIPTS` }}", |
| 20 | "apt_repository": "{{ env `APT_REPOSITORY` }}", |
azvyagintsev | 0f697cf | 2018-06-22 11:44:13 +0300 | [diff] [blame] | 21 | "apt_repository_gpg": "{{ env `APT_REPOSITORY_GPG` }}" |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 22 | |
| 23 | }, |
| 24 | "provisioners": [ |
| 25 | { |
| 26 | "type": "file", |
azvyagintsev | 5a2d6ec | 2018-07-19 21:25:25 +0300 | [diff] [blame] | 27 | "source": "files/root/", |
| 28 | "destination": "/root" |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 29 | }, |
| 30 | { |
| 31 | "type": "file", |
Ivan Berezovskiy | 738ce82 | 2018-11-16 13:00:24 +0400 | [diff] [blame] | 32 | "source": "files/opt/bootstrap.saltstack.com.sh", |
| 33 | "destination": "/opt/bootstrap.saltstack.com.sh" |
| 34 | }, |
| 35 | { |
| 36 | "environment_vars": [ |
| 37 | "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}", |
| 38 | "PACKER_OFFLINE_BUILD=true" |
| 39 | ], |
| 40 | "type": "shell", |
| 41 | "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", |
| 42 | "expect_disconnect": "true", |
| 43 | "scripts": [ |
| 44 | "scripts/base_set_hostname.sh", |
| 45 | "scripts/base.sh", |
| 46 | "scripts/motd.sh", |
| 47 | "scripts/network.sh", |
| 48 | "scripts/reboot.sh" |
| 49 | ] |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 50 | }, |
| 51 | { |
| 52 | "environment_vars": [ |
| 53 | "CLUSTER_MODEL={{ user `cluster_model` }}", |
| 54 | "CLUSTER_MODEL_REF={{ user `cluster_model_ref` }}", |
| 55 | "CLUSTER_NAME={{ user `cluster_name` }}", |
azvyagintsev | ffa75b4 | 2018-06-06 20:38:54 +0300 | [diff] [blame] | 56 | "BS_HOSTNAME={{ user `bs_hostname` }}", |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 57 | "SALTSTACK_GPG={{ user `saltstack_gpg` }}", |
| 58 | "SALTSTACK_REPO={{ user `saltstack_repo` }}", |
| 59 | "APT_MIRANTIS_GPG={{ user `apt_mirantis_gpg` }}", |
| 60 | "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}", |
| 61 | "GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}", |
| 62 | "APT_REPOSITORY={{ user `apt_repository` }}", |
| 63 | "APT_REPOSITORY_GPG={{ user `apt_repository_gpg` }}", |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 64 | "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}", |
Ivan Berezovskiy | 738ce82 | 2018-11-16 13:00:24 +0400 | [diff] [blame] | 65 | "BOOTSTRAP_SALTSTACK_COM=file:///opt/bootstrap.saltstack.com.sh", |
| 66 | "MCP_VERSION={{ user `mcp_version` }}", |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 67 | "PACKER_OFFLINE_BUILD=true" |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 68 | ], |
| 69 | "type": "shell", |
Ivan Berezovskiy | 738ce82 | 2018-11-16 13:00:24 +0400 | [diff] [blame] | 70 | "pause_before": "60s", |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 71 | "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", |
Ivan Berezovskiy | 738ce82 | 2018-11-16 13:00:24 +0400 | [diff] [blame] | 72 | "expect_disconnect": "true", |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 73 | "scripts": [ |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 74 | "scripts/salt_bootstrap.sh", |
| 75 | "scripts/salt.sh" |
| 76 | ] |
| 77 | }, |
| 78 | { |
| 79 | "type": "file", |
| 80 | "source": "files/var/maas", |
| 81 | "destination": "/var/lib/maas/.maas_login.sh" |
| 82 | }, |
| 83 | { |
| 84 | "type": "file", |
| 85 | "source": "files/var/jenkins", |
Ivan Berezovskiy | 738ce82 | 2018-11-16 13:00:24 +0400 | [diff] [blame] | 86 | "destination": "/srv/volumes/jenkins/org.codefirst.SimpleThemeDecorator.xml" |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 87 | }, |
| 88 | { |
| 89 | "environment_vars": [ |
| 90 | "HOME=/root", |
| 91 | "MCP_VERSION={{ user `mcp_version` }}" |
| 92 | ], |
| 93 | "type": "shell", |
| 94 | "pause_before": "10s", |
| 95 | "scripts": [ |
| 96 | "scripts/security.sh", |
azvyagintsev | ffa75b4 | 2018-06-06 20:38:54 +0300 | [diff] [blame] | 97 | "scripts/cleanup.sh", |
azvyagintsev | 29410ee | 2018-07-12 20:02:30 +0300 | [diff] [blame] | 98 | "scripts/cleanup_salt.sh", |
| 99 | "scripts/cleanup_day01.sh", |
azvyagintsev | 1726e80 | 2018-06-15 16:55:44 +0300 | [diff] [blame] | 100 | "scripts/info.sh", |
| 101 | "scripts/zerodisk.sh" |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 102 | ] |
| 103 | }, |
| 104 | { |
| 105 | "type": "file", |
azvyagintsev | 5a2d6ec | 2018-07-19 21:25:25 +0300 | [diff] [blame] | 106 | "source": "files/etc/", |
| 107 | "destination": "/etc" |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 108 | } |
| 109 | ], |
azvyagintsev | e052fbe | 2018-12-13 22:08:32 +0200 | [diff] [blame^] | 110 | "post-processors": [ |
| 111 | { |
| 112 | "keep_input_artifact": false, |
| 113 | "output": "images/{{ user `image_name` }}.qcow2", |
| 114 | "type": "vagrant", |
| 115 | "only": [ |
| 116 | "qemu" |
| 117 | ] |
| 118 | } |
| 119 | ], |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 120 | "builders": [ |
| 121 | { |
| 122 | "type": "qemu", |
| 123 | "qemuargs": [ |
| 124 | [ |
| 125 | "-m", |
| 126 | "8096M" |
| 127 | ], |
| 128 | [ |
Ivan Berezovskiy | 23035a2 | 2018-11-14 13:25:51 +0400 | [diff] [blame] | 129 | "-cdrom", |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 130 | "config-drive/cloudata.iso" |
| 131 | ], |
| 132 | [ |
| 133 | "-smp", |
| 134 | "4" |
azvyagintsev | 262b28c | 2018-10-23 18:38:42 +0300 | [diff] [blame] | 135 | ], |
| 136 | ["-device", "virtio-net,netdev=user.0"], |
| 137 | ["-object","rng-random,id=objrng0,filename=/dev/urandom"], |
| 138 | ["-device", "virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x10" ] |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 139 | ], |
| 140 | "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}", |
Jiri Broulik | b59b154 | 2018-04-10 18:33:28 +0200 | [diff] [blame] | 141 | "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}", |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 142 | "format": "qcow2", |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 143 | "disk_compression": true, |
Jiri Broulik | 2c75a20 | 2018-04-10 15:05:38 +0200 | [diff] [blame] | 144 | "iso_checksum": "566efef1d6f12e7d3a994c2405bdb642", |
| 145 | "iso_checksum_type": "md5", |
| 146 | "iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img", |
azvyagintsev | 0f697cf | 2018-06-22 11:44:13 +0300 | [diff] [blame] | 147 | "iso_target_path": "{{ user `images_cache`}}/release-20180306_xenial-server-cloudimg-amd64-disk1.img", |
Jiri Broulik | 2c75a20 | 2018-04-10 15:05:38 +0200 | [diff] [blame] | 148 | "disk_image": true, |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 149 | "accelerator": "kvm", |
| 150 | "disk_size": "{{ user `disk_size`}}", |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 151 | "headless": true, |
| 152 | "ssh_username": "{{user `user`}}", |
| 153 | "ssh_password": "{{user `password`}}", |
azvyagintsev | 0adfe68 | 2018-06-13 16:29:40 +0300 | [diff] [blame] | 154 | "ssh_host_port_min": 7000, |
| 155 | "ssh_host_port_max": 7050, |
azvyagintsev | dd13784 | 2018-07-13 18:13:06 +0300 | [diff] [blame] | 156 | "shutdown_command": "shutdown -P now", |
Jiri Broulik | 4ea221c | 2018-04-10 13:48:06 +0200 | [diff] [blame] | 157 | "boot_wait": "2s", |
| 158 | "ssh_wait_timeout": "360s" |
| 159 | } |
| 160 | ] |
| 161 | } |