Add build_dir variable for build
[osm/devops.git] / packer / ubuntu1604-juju.json
1 {
2   "provisioners": [
3     {
4       "type": "shell",
5       "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
6       "script": "scripts/install_packages.sh"
7     },
8     {
9       "type": "shell",
10       "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
11       "script": "scripts/setup.sh"
12     },
13     {
14         "type": "file",
15         "source": "scripts/lxd-bridge",
16         "destination": "/tmp/lxd-bridge"
17     },
18     {
19         "type": "shell",
20         "script": "scripts/lxd-setup.sh"
21     },
22     {
23         "type": "shell",
24         "inline": ["echo 'vagrant' | sudo shutdown -r now"],
25         "expect_disconnect": "true"
26     },
27     {
28         "type": "shell",
29         "script": "scripts/juju-setup.sh",
30         "pause_before": "10s"
31     },
32     {
33         "type": "shell",
34         "script": "scripts/cleanup.sh"
35     }
36   ],
37   "variables": {
38     "build_dir": "jujubase-{{timestamp}}"
39   },
40   "builders": [
41     {
42       "type": "virtualbox-iso",
43       "boot_command": [
44         "<enter><wait><f6><esc><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
45         "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
46         "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
47         "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
48         "/install/vmlinuz<wait>",
49         " auto<wait>",
50         " console-setup/ask_detect=false<wait>",
51         " console-setup/layoutcode=us<wait>",
52         " console-setup/modelcode=pc105<wait>",
53         " debconf/frontend=noninteractive<wait>",
54         " debian-installer=en_US<wait>",
55         " fb=false<wait>",
56         " initrd=/install/initrd.gz<wait>",
57         " kbd-chooser/method=us<wait>",
58         " keyboard-configuration/layout=USA<wait>",
59         " keyboard-configuration/variant=USA<wait>",
60         " locale=en_US<wait>",
61         " netcfg/get_domain=vm<wait>",
62         " netcfg/get_hostname=vagrant<wait>",
63         " grub-installer/bootdev=/dev/sda<wait>",
64         " noapic<wait>",
65         " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",
66         " -- <wait>",
67         "<enter><wait>"
68       ],
69       "boot_wait": "10s",
70       "disk_size": 40000,
71       "guest_os_type": "Ubuntu_64",
72       "headless": true,
73       "http_directory": "http",
74       "iso_urls": [
75         "iso/ubuntu-16.04.4-server-amd64.iso",
76         "http://releases.ubuntu.com/16.04/ubuntu-16.04.4-server-amd64.iso"
77       ],
78       "iso_checksum_type": "sha256",
79       "iso_checksum": "0a03608988cfd2e50567990dc8be96fb3c501e198e2e6efcb846d89efc7b89f2",
80       "ssh_username": "vagrant",
81       "ssh_password": "vagrant",
82       "ssh_port": 22,
83       "ssh_wait_timeout": "10000s",
84       "shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
85       "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
86       "virtualbox_version_file": ".vbox_version",
87       "output_directory": "{{user `build_dir`}}",
88       "vm_name": "xenial-jujubase",
89       "vboxmanage": [
90         [
91           "modifyvm",
92           "{{.Name}}",
93           "--memory",
94           "4096"
95         ],
96         [
97           "modifyvm",
98           "{{.Name}}",
99           "--cpus",
100           "2"
101         ]
102       ]
103     }
104   ],
105   "post-processors": [
106     {
107       "output": "{{user `build_dir`}}/{{.Provider}}-jujubase.box",
108       "type": "vagrant",
109       "keep_input_artifact": true
110     }
111   ]
112 }