· 7 years ago · Dec 31, 2018, 07:04 PM
1{
2"variables": {
3 "PACKER_OS_FLAVOUR": "kali",
4 "PACKER_BOX_NAME": "http://cdimage.kali.org/kali-2018.4/kali-linux-2018.4-amd64.iso",
5 "AWS_ACCESS_KEY_ID": "{{env `AWS_ACCESS_KEY_ID`}}",
6 "AWS_SECRET_ACCESS_KEY": "{{env `AWS_SECRET_ACCESS_KEY`}}",
7 "DIGITALOCEAN_API_TOKEN": "{{env `DIGITALOCEAN_API_TOKEN`}}",
8 "vm_name":"kali_linux",
9 "box_name" : "kali.box",
10 "box_desc" : "Kali Linux"
11 },
12 "builders": [
13 {
14 "type": "virtualbox-iso",
15 "boot_command": [
16 "<esc><wait>",
17 "<esc><wait>",
18 "<enter><wait>",
19 "/install/vmlinuz<wait>",
20 " auto<wait>",
21 " console-setup/ask_detect=false<wait>",
22 " console-setup/layoutcode=us<wait>",
23 " console-setup/modelcode=pc105<wait>",
24 " debconf/frontend=noninteractive<wait>",
25 " debian-installer=en_US<wait>",
26 " fb=false<wait>",
27 " initrd=/install/initrd.gz<wait>",
28 " kbd-chooser/method=us<wait>",
29 " keyboard-configuration/layout=USA<wait>",
30 " keyboard-configuration/variant=USA<wait>",
31 " locale=en_US<wait>",
32 " netcfg/get_domain=vm<wait>",
33 " netcfg/get_hostname=vagrant<wait>",
34 " noapic<wait>",
35 " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
36 " -- <wait>",
37 "<enter><wait>"
38 ],
39 "boot_wait": "10s",
40 "headless": false,
41 "disk_size": 40140,
42 "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
43 "guest_os_type": "Debian_64",
44 "guest_additions_mode": "attach",
45 "http_directory": "http",
46 "iso_checksum": "7c65d6a319448efe4ee1be5b5a93d48ef30687d4e3f507896b46b9c2226a0ed0",
47 "iso_checksum_type": "sha256",
48 "iso_url": "{{ user `PACKER_BOX_NAME` }}",
49 "shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
50 "ssh_password": "vagrant",
51 "ssh_port": 22,
52 "ssh_username": "vagrant",
53 "ssh_wait_timeout": "10000s",
54 "vm_name": "{{ user `vm_name`}}",
55 "vboxmanage": [
56 ["modifyvm", "{{.Name}}", "--memory", "2524"],
57 ["modifyvm", "{{.Name}}", "--cpus", "2"]
58 ],
59 "virtualbox_version_file": ".vbox_version"
60 },
61 {
62 "type": "amazon-ebs",
63 "access_key": "{{ user `AWS_ACCESS_KEY_ID` }}",
64 "secret_key": "{{ user `AWS_SECRET_ACCESS_KEY` }}",
65 "region": "us-east-1",
66 "source_ami": "ami-10b68a78",
67 "instance_type": "t1.micro",
68 "ssh_username": "ubuntu",
69 "ami_name": "packer-app-server {{timestamp}}"
70 },
71 {
72 "type": "googlecompute",
73 "account_file": "account.json",
74 "project_id": "devops-intro-project",
75 "source_image": "ubuntu-1404-trusty-v20150316",
76 "zone": "us-central1-a",
77 "image_name": "application-ubuntu-1404-{{timestamp}}",
78 "machine_type": "n1-standard-1",
79 "ssh_username": "ubuntu"
80 },
81 {
82 "type": "digitalocean",
83 "api_token": "{{ user `DIGITALOCEAN_API_TOKEN` }}",
84 "image": "ubuntu-14-04-x64",
85 "region": "tor1",
86 "size": "512mb",
87 "droplet_name": "udacity-devops",
88 "private_networking": true
89 }
90],
91
92"provisioners": [
93 {
94 "type": "shell",
95 "execute_command": "echo 'vagrant'|{{.Vars}} sudo -S -E bash '{{.Path}}'",
96 "scripts": [
97 "scripts/update.sh"
98 ]
99 },
100 {
101 "type": "shell",
102 "only": ["virtualbox-iso"],
103 "execute_command": "echo 'vagrant'|sudo -S -E bash '{{.Path}}'",
104 "scripts": [
105 "scripts/virtualbox.sh",
106 "scripts/vagrant.sh"
107 ]
108 },
109 {
110 "type": "shell",
111 "execute_command": "echo 'vagrant'|sudo -S -E bash '{{.Path}}'",
112 "scripts": [
113 "scripts/application.sh",
114 "scripts/cleanup.sh"
115 ]
116 }
117],
118"post-processors": [
119 [
120 {
121 "type": "vagrant",
122 "except": ["googlecompute", "digitalocean"],
123 "compression_level": "9",
124 "output": "{{.Provider}}/{{ user `PACKER_BOX_NAME` }}-appserver_{{.Provider}}.box"
125 }
126 ]
127]
128
129==> virtualbox-iso: Retrieving Guest additions
130 virtualbox-iso: Using file in-place: file:///usr/share/virtualbox/VBoxGuestAdditions.iso
131==> virtualbox-iso: Retrieving ISO
132 virtualbox-iso: Error downloading: open /var/opt/devops_learning /first_packer_script/packer_cache/578e07b27b900c76095a2807dbe0be7e012acde58bd087407f093422fe5a1e11.iso: no such file or directory
133==> virtualbox-iso: ISO download failed.
134Build 'virtualbox-iso' errored: ISO download failed.