Add packer scripts for vagrant image generation
[osm/devops.git] / packer / ubuntu1604-ovf-osm.json
1 {
2   "provisioners": [
3     {
4       "type": "shell",
5       "script": "scripts/get-install-osm.sh",
6       "execute_command": "{{.Path}} {{user `osm_installer`}}"
7     },
8     {
9       "type": "shell",
10       "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
11       "script": "scripts/cleanup.sh"
12     }
13   ],
14   "variables": {
15     "osm_installer": "https://osm-download.etsi.org/ftp/osm-4.0-four/install_osm.sh",
16     "input_ovf": "output-virtualbox-iso/packer-ubuntu-16.04-amd64-juju.ovf",
17     "vm_name": "packer-ubuntu-16.04-ovf-amd64"
18   },
19   "builders": [
20     {
21       "type": "virtualbox-ovf",
22       "source_path": "{{user `input_ovf`}}",
23       "headless": true,
24       "ssh_username": "vagrant",
25       "ssh_password": "vagrant",
26       "ssh_port": 22,
27       "ssh_wait_timeout": "10000s",
28       "shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
29       "virtualbox_version_file": ".vbox_version",
30       "vm_name": "{{user `vm_name`}}",
31       "vboxmanage": [
32         [
33           "modifyvm",
34           "{{.Name}}",
35           "--memory",
36           "4096"
37         ],
38         [
39           "modifyvm",
40           "{{.Name}}",
41           "--cpus",
42           "2"
43         ]
44       ]
45     }
46   ],
47   "post-processors": [
48     {
49       "output": "builds/{{.Provider}}-osm.box",
50       "type": "vagrant"
51     }
52   ]
53 }