-
Notifications
You must be signed in to change notification settings - Fork 114
/
my_ubuntu-server.json
133 lines (133 loc) · 5.15 KB
/
my_ubuntu-server.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
{
"_comment0": "NAME=my_ubuntu-20.04-server-amd64 UBUNTU_IMAGES_URL=http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/current/legacy-images PACKER_IMAGES_OUTPUT_DIR=/var/tmp/ LOGDIR=/tmp/ packer build my_ubuntu-server.json",
"_comment1": "NAME=my_ubuntu-18.04-server-amd64 UBUNTU_IMAGES_URL=http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images PACKER_IMAGES_OUTPUT_DIR=/var/tmp/ LOGDIR=/tmp/ packer build my_ubuntu-server.json",
"_comment2": "NAME=my_ubuntu-16.04-server-amd64 UBUNTU_IMAGES_URL=http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images PACKER_IMAGES_OUTPUT_DIR=/var/tmp/ LOGDIR=/tmp/ packer build my_ubuntu-server.json",
"builders": [
{
"accelerator": "{{ user `accelerator` }}",
"boot_command": [
"<tab>",
"url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu-server/{{ user `preseed_file_name` }} ",
"auto=true ",
"net.ifnames=0 ",
"hostname=localhost ",
"<enter>"
],
"boot_wait": "10s",
"cpus": "{{ user `cpus` }}",
"disk_size": "{{ user `disk_size` }}",
"headless": "{{ user `headless` }}",
"http_directory": "http",
"iso_checksum": "file:{{ user `ubuntu_images_url` }}/SHA256SUMS",
"iso_urls": ["{{ user `ubuntu_images_url` }}/netboot/mini.iso"],
"memory": "{{ user `memory` }}",
"output_directory": "{{ user `name` }}-qemu",
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
"ssh_password": "{{ user `ssh_password` }}",
"ssh_username": "{{ user `ssh_username` }}",
"ssh_timeout": "1h",
"type": "qemu",
"vm_name": "{{ user `name` }}"
},
{
"boot_command": [
"<tab>",
"url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu-server/{{ user `preseed_file_name` }} ",
"auto=true ",
"net.ifnames=0 ",
"hostname=localhost ",
"<enter>"
],
"boot_wait": "10s",
"cpus": "{{ user `cpus` }}",
"disk_size": "{{ user `disk_size` }}",
"guest_additions_mode": "disable",
"guest_os_type": "Ubuntu_64",
"hard_drive_interface": "sata",
"headless": "{{ user `headless` }}",
"http_directory": "http",
"iso_checksum": "file:{{ user `ubuntu_images_url` }}/SHA256SUMS",
"iso_urls": ["{{ user `ubuntu_images_url` }}/netboot/mini.iso"],
"memory": "{{ user `memory` }}",
"output_directory": "{{ user `name` }}-virtualbox-iso",
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
"ssh_password": "{{ user `ssh_password` }}",
"ssh_username": "{{ user `ssh_username` }}",
"ssh_timeout": "1h",
"type": "virtualbox-iso",
"vboxmanage": [
["modifyvm", "{{ .Name }}", "--graphicscontroller", "vmsvga"],
[
"modifyvm",
"{{ .Name }}",
"--recordingfile",
"{{ user `packer_templates_logs` }}/{{ user `name` }}-virtualbox.webm"
],
["modifyvm", "{{ .Name }}", "--recordingscreens", "0"],
["modifyvm", "{{ .Name }}", "--recording", "on"]
],
"vm_name": "{{ user `name` }}"
}
],
"post-processors": [
[
{
"compression_level": 9,
"output": "{{ user `packer_images_output_dir` }}/{{ user `name` }}-{{ .Provider }}.box",
"type": "vagrant",
"vagrantfile_template": "Vagrantfile-linux.template"
}
]
],
"provisioners": [
{
"execute_command": "echo 'vagrant' | sudo -S -E bash '{{ .Path }}'",
"scripts": [
"scripts/linux-common/vagrant.sh",
"scripts/ubuntu/update.sh",
"scripts/ubuntu/add_libpam-systemd.sh",
"scripts/ubuntu/disable_apt-daily.sh",
"scripts/ubuntu/virtualbox-guest.sh"
],
"type": "shell"
},
{
"ansible_env_vars": ["ANSIBLE_CONFIG=ansible/ansible.cfg"],
"extra_arguments": [
"--become",
"--extra-vars",
"packer_build_name={{ user `name` }}"
],
"playbook_file": "ansible/site.yml",
"type": "ansible",
"user": "vagrant"
},
{
"execute_command": "sudo -E bash '{{ .Path }}'",
"scripts": [
"scripts/linux-common/packer-virt-sysprep/sysprep-op-dhcp-client-state.sh",
"scripts/linux-common/packer-virt-sysprep/sysprep-op-logfiles.sh",
"scripts/linux-common/packer-virt-sysprep/sysprep-op-machine-id.sh",
"scripts/linux-common/packer-virt-sysprep/sysprep-op-package-manager-cache.sh",
"scripts/linux-common/packer-virt-sysprep/sysprep-op-ssh-hostkeys.sh",
"scripts/linux-common/packer-virt-sysprep/sysprep-op-tmp-files.sh",
"scripts/linux-common/packer-virt-sysprep/sysprep-op-disk-space.sh"
],
"type": "shell"
}
],
"variables": {
"accelerator": "kvm",
"cpus": "4",
"disk_size": "51200",
"headless": "false",
"memory": "8192",
"name": "{{ env `NAME` }}",
"packer_images_output_dir": "{{ env `PACKER_IMAGES_OUTPUT_DIR` }}",
"packer_templates_logs": "{{ env `LOGDIR` }}",
"preseed_file_name": "my-preseed.cfg",
"ssh_password": "vagrant",
"ssh_username": "vagrant",
"ubuntu_images_url": "{{ env `UBUNTU_IMAGES_URL` }}"
}
}