blob: e7d90d31129c69ff1b27c619b3df2a20078c733f [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 "formula_version": "{{ env `FORMULA_VERSION` }}",
14 "mcp_version": "{{ env `MCP_VERSION` }}",
15 "ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}",
16 "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
17 "saltstack_repo": "{{ env `SALTSTACK_REPO` }}",
18 "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_GPG` }}",
19 "apt_mirantis_salt_repo": "{{ env `APT_MIRANTIS_SALT_REPO` }}",
20 "git_salt_formulas_scripts": "{{ env `GIT_SALT_FORMULAS_SCRIPTS` }}",
21 "apt_repository": "{{ env `APT_REPOSITORY` }}",
azvyagintsev0f697cf2018-06-22 11:44:13 +030022 "apt_repository_gpg": "{{ env `APT_REPOSITORY_GPG` }}"
Jiri Broulik4ea221c2018-04-10 13:48:06 +020023
24 },
25 "provisioners": [
26 {
27 "type": "file",
azvyagintsev5a2d6ec2018-07-19 21:25:25 +030028 "source": "files/root/",
29 "destination": "/root"
Jiri Broulik4ea221c2018-04-10 13:48:06 +020030 },
31 {
32 "type": "file",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040033 "source": "files/opt/bootstrap.saltstack.com.sh",
34 "destination": "/opt/bootstrap.saltstack.com.sh"
35 },
36 {
37 "environment_vars": [
38 "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}",
39 "PACKER_OFFLINE_BUILD=true"
40 ],
41 "type": "shell",
42 "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
43 "expect_disconnect": "true",
44 "scripts": [
45 "scripts/base_set_hostname.sh",
46 "scripts/base.sh",
47 "scripts/motd.sh",
48 "scripts/network.sh",
49 "scripts/reboot.sh"
50 ]
Jiri Broulik4ea221c2018-04-10 13:48:06 +020051 },
52 {
53 "environment_vars": [
54 "CLUSTER_MODEL={{ user `cluster_model` }}",
55 "CLUSTER_MODEL_REF={{ user `cluster_model_ref` }}",
56 "CLUSTER_NAME={{ user `cluster_name` }}",
azvyagintsevffa75b42018-06-06 20:38:54 +030057 "BS_HOSTNAME={{ user `bs_hostname` }}",
Jiri Broulik4ea221c2018-04-10 13:48:06 +020058 "FORMULA_VERSION={{ user `formula_version` }}",
Jiri Broulik4ea221c2018-04-10 13:48:06 +020059 "SALTSTACK_GPG={{ user `saltstack_gpg` }}",
60 "SALTSTACK_REPO={{ user `saltstack_repo` }}",
61 "APT_MIRANTIS_GPG={{ user `apt_mirantis_gpg` }}",
62 "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
63 "GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}",
64 "APT_REPOSITORY={{ user `apt_repository` }}",
65 "APT_REPOSITORY_GPG={{ user `apt_repository_gpg` }}",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040066 "FORMULA_VERSION={{ user `formula_version` }}",
azvyagintsev0adfe682018-06-13 16:29:40 +030067 "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040068 "BOOTSTRAP_SALTSTACK_COM=file:///opt/bootstrap.saltstack.com.sh",
69 "MCP_VERSION={{ user `mcp_version` }}",
azvyagintsev0adfe682018-06-13 16:29:40 +030070 "PACKER_OFFLINE_BUILD=true"
Jiri Broulik4ea221c2018-04-10 13:48:06 +020071 ],
72 "type": "shell",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040073 "pause_before": "60s",
Jiri Broulik4ea221c2018-04-10 13:48:06 +020074 "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040075 "expect_disconnect": "true",
Jiri Broulik4ea221c2018-04-10 13:48:06 +020076 "scripts": [
Jiri Broulik4ea221c2018-04-10 13:48:06 +020077 "scripts/salt_bootstrap.sh",
78 "scripts/salt.sh"
79 ]
80 },
81 {
82 "type": "file",
83 "source": "files/var/maas",
84 "destination": "/var/lib/maas/.maas_login.sh"
85 },
86 {
87 "type": "file",
88 "source": "files/var/jenkins",
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040089 "destination": "/srv/volumes/jenkins/org.codefirst.SimpleThemeDecorator.xml"
Jiri Broulik4ea221c2018-04-10 13:48:06 +020090 },
91 {
92 "environment_vars": [
93 "HOME=/root",
94 "MCP_VERSION={{ user `mcp_version` }}"
95 ],
96 "type": "shell",
97 "pause_before": "10s",
98 "scripts": [
99 "scripts/security.sh",
azvyagintsevffa75b42018-06-06 20:38:54 +0300100 "scripts/cleanup.sh",
azvyagintsev29410ee2018-07-12 20:02:30 +0300101 "scripts/cleanup_salt.sh",
102 "scripts/cleanup_day01.sh",
azvyagintsev1726e802018-06-15 16:55:44 +0300103 "scripts/info.sh",
104 "scripts/zerodisk.sh"
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200105 ]
106 },
107 {
108 "type": "file",
azvyagintsev5a2d6ec2018-07-19 21:25:25 +0300109 "source": "files/etc/",
110 "destination": "/etc"
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200111 }
112 ],
113 "builders": [
114 {
115 "type": "qemu",
116 "qemuargs": [
117 [
118 "-m",
119 "8096M"
120 ],
121 [
Ivan Berezovskiy23035a22018-11-14 13:25:51 +0400122 "-cdrom",
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200123 "config-drive/cloudata.iso"
124 ],
125 [
126 "-smp",
127 "4"
azvyagintsev262b28c2018-10-23 18:38:42 +0300128 ],
129 ["-device", "virtio-net,netdev=user.0"],
130 ["-object","rng-random,id=objrng0,filename=/dev/urandom"],
131 ["-device", "virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x10" ]
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200132 ],
133 "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
Jiri Broulikb59b1542018-04-10 18:33:28 +0200134 "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}",
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200135 "format": "qcow2",
azvyagintsev0adfe682018-06-13 16:29:40 +0300136 "disk_compression": true,
Jiri Broulik2c75a202018-04-10 15:05:38 +0200137 "iso_checksum": "566efef1d6f12e7d3a994c2405bdb642",
138 "iso_checksum_type": "md5",
139 "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 +0300140 "iso_target_path": "{{ user `images_cache`}}/release-20180306_xenial-server-cloudimg-amd64-disk1.img",
Jiri Broulik2c75a202018-04-10 15:05:38 +0200141 "disk_image": true,
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200142 "accelerator": "kvm",
143 "disk_size": "{{ user `disk_size`}}",
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200144 "headless": true,
145 "ssh_username": "{{user `user`}}",
146 "ssh_password": "{{user `password`}}",
azvyagintsev0adfe682018-06-13 16:29:40 +0300147 "ssh_host_port_min": 7000,
148 "ssh_host_port_max": 7050,
azvyagintsevdd137842018-07-13 18:13:06 +0300149 "shutdown_command": "shutdown -P now",
Jiri Broulik4ea221c2018-04-10 13:48:06 +0200150 "boot_wait": "2s",
151 "ssh_wait_timeout": "360s"
152 }
153 ]
154}