blob: 84f0a8e61116853033bf2167d63cb9e037f023bf [file] [log] [blame]
Ivan Berezovskiyc46e7c02018-10-29 18:22:09 +04001{
2 "variables": {
3 "user": "root",
4 "password": "r00tme",
5 "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}",
6 "disk_size": "50000",
7 "do_api_token": "{{ env `DO_API_TOKEN` }}",
8 "image_name": "{{ env `IMAGE_NAME` }}",
9 "cluster_model": "{{ env `CLUSTER_MODEL` }}",
10 "cluster_model_ref": "{{ env `CLUSTER_MODEL_REF` }}",
11 "cluster_name": "{{ env `CLUSTER_NAME` }}",
12 "bs_hostname": "cfg01",
Ivan Berezovskiyc46e7c02018-10-29 18:22:09 +040013 "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` }}",
21 "apt_repository_gpg": "{{ env `APT_REPOSITORY_GPG` }}"
22 },
23 "provisioners": [
24 {
25 "type": "file",
26 "source": "files/root/",
27 "destination": "/root"
28 },
29 {
30 "type": "file",
31 "source": "files/opt/bootstrap.saltstack.com.sh",
32 "destination": "/opt/bootstrap.saltstack.com.sh"
33 },
34 {
35 "environment_vars": [
36 "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}",
37 "PACKER_OFFLINE_BUILD=true"
38 ],
39 "type": "shell",
40 "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
41 "expect_disconnect": "true",
42 "scripts": [
43 "scripts/base_set_hostname.sh",
44 "scripts/base.sh",
45 "scripts/motd.sh",
46 "scripts/network.sh",
47 "scripts/reboot.sh"
48 ]
49 },
50 {
51 "environment_vars": [
52 "CLUSTER_MODEL={{ user `cluster_model` }}",
53 "CLUSTER_MODEL_REF={{ user `cluster_model_ref` }}",
54 "CLUSTER_NAME={{ user `cluster_name` }}",
55 "BS_HOSTNAME={{ user `bs_hostname` }}",
Ivan Berezovskiyc46e7c02018-10-29 18:22:09 +040056 "SALTSTACK_GPG={{ user `saltstack_gpg` }}",
57 "SALTSTACK_REPO={{ user `saltstack_repo` }}",
58 "APT_MIRANTIS_GPG={{ user `apt_mirantis_gpg` }}",
59 "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
60 "GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}",
61 "APT_REPOSITORY={{ user `apt_repository` }}",
62 "APT_REPOSITORY_GPG={{ user `apt_repository_gpg` }}",
Ivan Berezovskiyc46e7c02018-10-29 18:22:09 +040063 "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
64 "BOOTSTRAP_SALTSTACK_COM=file:///opt/bootstrap.saltstack.com.sh",
Ivan Berezovskiy23035a22018-11-14 13:25:51 +040065 "MCP_VERSION={{ user `mcp_version` }}",
Ivan Berezovskiyc46e7c02018-10-29 18:22:09 +040066 "PACKER_OFFLINE_BUILD=true"
67 ],
68 "type": "shell",
69 "pause_before": "60s",
70 "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
71 "expect_disconnect": "true",
72 "scripts": [
73 "scripts/salt_bootstrap.sh",
74 "scripts/salt.sh"
75 ]
76 },
77 {
Ivan Berezovskiyc46e7c02018-10-29 18:22:09 +040078 "type": "shell",
79 "pause_before": "10s",
80 "scripts": [
81 "scripts/security.sh",
82 "scripts/info.sh",
83 "scripts/zerodisk.sh"
84 ]
85 },
86 {
87 "type": "file",
88 "source": "files/etc/",
89 "destination": "/etc"
90 }
91 ],
92 "builders": [
93 {
94 "type": "qemu",
95 "qemuargs": [
96 [
97 "-m",
98 "8096M"
99 ],
100 [
Ivan Berezovskiy23035a22018-11-14 13:25:51 +0400101 "-cdrom",
Ivan Berezovskiyc46e7c02018-10-29 18:22:09 +0400102 "config-drive/cloudata.iso"
103 ],
104 [
105 "-smp",
106 "4"
107 ]
108 ],
109 "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
110 "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}",
111 "format": "qcow2",
112 "disk_compression": true,
113 "iso_checksum": "566efef1d6f12e7d3a994c2405bdb642",
114 "iso_checksum_type": "md5",
115 "iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
116 "iso_target_path": "{{ user `images_cache`}}/release-20180306_xenial-server-cloudimg-amd64-disk1.img",
117 "disk_image": true,
118 "accelerator": "kvm",
119 "disk_size": "{{ user `disk_size`}}",
120 "headless": true,
121 "ssh_username": "{{user `user`}}",
122 "ssh_password": "{{user `password`}}",
123 "ssh_host_port_min": 7000,
124 "ssh_host_port_max": 7050,
125 "shutdown_command": "shutdown -P now",
126 "boot_wait": "2s",
127 "ssh_wait_timeout": "360s"
128 }
129 ]
130}