blob: a862869b029215e82d5e3684ad2d2ecba75304ec [file] [log] [blame]
Jiri Broulik4ea221c2018-04-10 13:48:06 +02001{
2 "variables": {
3 "user": "root",
4 "password": "r00tme",
azvyagintsev0f697cf2018-06-22 11:44:13 +03005 "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}",
6 "disk_size": "50000",
Jiri Broulik4ea221c2018-04-10 13:48:06 +02007 "do_api_token": "{{ env `DO_API_TOKEN` }}",
8 "image_name": "{{ env `IMAGE_NAME` }}",
Jiri Broulik3ffb7452018-04-12 10:37:07 +02009 "cluster_model": "{{ env `CLUSTER_MODEL` }}",
10 "cluster_model_ref": "{{ env `CLUSTER_MODEL_REF` }}",
11 "cluster_name": "{{ env `CLUSTER_NAME` }}",
azvyagintsevffa75b42018-06-06 20:38:54 +030012 "bs_hostname": "cfg01",
Jiri Broulik3ffb7452018-04-12 10:37:07 +020013 "mcp_version": "{{ env `MCP_VERSION` }}",
14 "ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}",
15 "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
16 "saltstack_repo": "{{ env `SALTSTACK_REPO` }}",
Ivan Berezovskiy7630eaf2018-12-17 16:33:14 +040017 "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_SALT_GPG` }}",
Jiri Broulik3ffb7452018-04-12 10:37:07 +020018 "apt_mirantis_salt_repo": "{{ env `APT_MIRANTIS_SALT_REPO` }}",
Ivan Berezovskiy038f6b62018-12-14 14:12:23 +040019 "git_salt_formulas_scripts": "{{ env `GIT_SALT_FORMULAS_SCRIPTS` }}"
Jiri Broulik4ea221c2018-04-10 13:48:06 +020020 },
21 "provisioners": [
22 {
23 "type": "file",
azvyagintsev5a2d6ec2018-07-19 21:25:25 +030024 "source": "files/root/",
25 "destination": "/root"
Jiri Broulik4ea221c2018-04-10 13:48:06 +020026 },
27 {
28 "type": "file",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040029 "source": "files/opt/bootstrap.saltstack.com.sh",
30 "destination": "/opt/bootstrap.saltstack.com.sh"
31 },
32 {
33 "environment_vars": [
34 "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}",
35 "PACKER_OFFLINE_BUILD=true"
36 ],
37 "type": "shell",
38 "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
39 "expect_disconnect": "true",
40 "scripts": [
41 "scripts/base_set_hostname.sh",
42 "scripts/base.sh",
43 "scripts/motd.sh",
44 "scripts/network.sh",
45 "scripts/reboot.sh"
46 ]
Jiri Broulik4ea221c2018-04-10 13:48:06 +020047 },
48 {
49 "environment_vars": [
50 "CLUSTER_MODEL={{ user `cluster_model` }}",
51 "CLUSTER_MODEL_REF={{ user `cluster_model_ref` }}",
52 "CLUSTER_NAME={{ user `cluster_name` }}",
azvyagintsevffa75b42018-06-06 20:38:54 +030053 "BS_HOSTNAME={{ user `bs_hostname` }}",
Jiri Broulik4ea221c2018-04-10 13:48:06 +020054 "SALTSTACK_GPG={{ user `saltstack_gpg` }}",
55 "SALTSTACK_REPO={{ user `saltstack_repo` }}",
Ivan Berezovskiy7630eaf2018-12-17 16:33:14 +040056 "APT_MIRANTIS_SALT_GPG={{ user `apt_mirantis_gpg` }}",
Jiri Broulik4ea221c2018-04-10 13:48:06 +020057 "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
58 "GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}",
azvyagintsev0adfe682018-06-13 16:29:40 +030059 "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040060 "BOOTSTRAP_SALTSTACK_COM=file:///opt/bootstrap.saltstack.com.sh",
61 "MCP_VERSION={{ user `mcp_version` }}",
azvyagintsev0adfe682018-06-13 16:29:40 +030062 "PACKER_OFFLINE_BUILD=true"
Jiri Broulik4ea221c2018-04-10 13:48:06 +020063 ],
64 "type": "shell",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040065 "pause_before": "60s",
Jiri Broulik4ea221c2018-04-10 13:48:06 +020066 "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040067 "expect_disconnect": "true",
Jiri Broulik4ea221c2018-04-10 13:48:06 +020068 "scripts": [
Jiri Broulik4ea221c2018-04-10 13:48:06 +020069 "scripts/salt_bootstrap.sh",
70 "scripts/salt.sh"
71 ]
72 },
73 {
74 "type": "file",
75 "source": "files/var/maas",
76 "destination": "/var/lib/maas/.maas_login.sh"
77 },
78 {
79 "type": "file",
80 "source": "files/var/jenkins",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040081 "destination": "/srv/volumes/jenkins/org.codefirst.SimpleThemeDecorator.xml"
Jiri Broulik4ea221c2018-04-10 13:48:06 +020082 },
83 {
84 "environment_vars": [
85 "HOME=/root",
86 "MCP_VERSION={{ user `mcp_version` }}"
87 ],
88 "type": "shell",
89 "pause_before": "10s",
90 "scripts": [
91 "scripts/security.sh",
azvyagintsevffa75b42018-06-06 20:38:54 +030092 "scripts/cleanup.sh",
azvyagintsev29410ee2018-07-12 20:02:30 +030093 "scripts/cleanup_salt.sh",
94 "scripts/cleanup_day01.sh",
azvyagintsev1726e802018-06-15 16:55:44 +030095 "scripts/info.sh",
Vladimir Khlyunev6a5023f2020-04-29 10:12:32 +000096 "scripts/zerodisk.sh"
Jiri Broulik4ea221c2018-04-10 13:48:06 +020097 ]
98 },
99 {
100 "type": "file",
azvyagintsev5a2d6ec2018-07-19 21:25:25 +0300101 "source": "files/etc/",
102 "destination": "/etc"
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200103 }
104 ],
105 "builders": [
106 {
107 "type": "qemu",
108 "qemuargs": [
109 [
110 "-m",
111 "8096M"
112 ],
113 [
Ivan Berezovskiy23035a22018-11-14 13:25:51 +0400114 "-cdrom",
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200115 "config-drive/cloudata.iso"
116 ],
117 [
118 "-smp",
119 "4"
azvyagintsev262b28c2018-10-23 18:38:42 +0300120 ],
121 ["-device", "virtio-net,netdev=user.0"],
122 ["-object","rng-random,id=objrng0,filename=/dev/urandom"],
123 ["-device", "virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x10" ]
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200124 ],
Aleksey Zvyagintsev42e76952018-12-14 13:40:44 +0000125 "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}.qcow2",
Jiri Broulikb59b1542018-04-10 18:33:28 +0200126 "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}",
azvyagintsev0adfe682018-06-13 16:29:40 +0300127 "disk_compression": true,
Aleksey Zvyagintsev42e76952018-12-14 13:40:44 +0000128 "disk_size": "{{ user `disk_size`}}",
129 "format": "qcow2",
Jiri Broulik2c75a202018-04-10 15:05:38 +0200130 "iso_checksum": "566efef1d6f12e7d3a994c2405bdb642",
131 "iso_checksum_type": "md5",
132 "iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
azvyagintsev0f697cf2018-06-22 11:44:13 +0300133 "iso_target_path": "{{ user `images_cache`}}/release-20180306_xenial-server-cloudimg-amd64-disk1.img",
Jiri Broulik2c75a202018-04-10 15:05:38 +0200134 "disk_image": true,
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200135 "accelerator": "kvm",
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200136 "headless": true,
137 "ssh_username": "{{user `user`}}",
138 "ssh_password": "{{user `password`}}",
azvyagintsev0adfe682018-06-13 16:29:40 +0300139 "ssh_host_port_min": 7000,
140 "ssh_host_port_max": 7050,
azvyagintsevdd137842018-07-13 18:13:06 +0300141 "shutdown_command": "shutdown -P now",
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200142 "boot_wait": "2s",
143 "ssh_wait_timeout": "360s"
144 }
145 ]
146}