-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert AM packer templates into HCL2
* Convert Ubuntu 20.04 base image template into HCL2 * Clean up Ubuntu 20.04 base template variables * Convert AM image template into HCL2 * Clean up AM image template variables
- Loading branch information
1 parent
fac6e5b
commit f2fe347
Showing
5 changed files
with
198 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 0 additions & 110 deletions
110
packer/templates/vagrant-base-ubuntu-20.04-amd64/template.json
This file was deleted.
Oops, something went wrong.
133 changes: 133 additions & 0 deletions
133
packer/templates/vagrant-base-ubuntu-20.04-amd64/template.json.pkr.hcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
packer { | ||
required_plugins { | ||
virtualbox = { | ||
source = "github.com/hashicorp/virtualbox" | ||
version = "~> 1" | ||
} | ||
} | ||
} | ||
|
||
variable "cpus" { | ||
type = string | ||
default = "2" | ||
} | ||
|
||
variable "disk_size" { | ||
type = string | ||
default = "20960" | ||
} | ||
|
||
variable "headless" { | ||
type = string | ||
default = "true" | ||
} | ||
|
||
variable "http_proxy" { | ||
type = string | ||
default = "${env("http_proxy")}" | ||
} | ||
|
||
variable "https_proxy" { | ||
type = string | ||
default = "${env("https_proxy")}" | ||
} | ||
|
||
variable "iso_checksum" { | ||
type = string | ||
default = "f11bda2f2caed8f420802b59f382c25160b114ccc665dbac9c5046e7fceaced2" | ||
} | ||
|
||
variable "memory" { | ||
type = string | ||
default = "4096" | ||
} | ||
|
||
variable "no_proxy" { | ||
type = string | ||
default = "${env("no_proxy")}" | ||
} | ||
|
||
variable "template" { | ||
type = string | ||
default = "vagrant-base-ubuntu-20.04-amd64" | ||
} | ||
|
||
source "virtualbox-iso" "ubuntu" { | ||
boot_command = [ | ||
"<enter><wait><f6><esc><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", | ||
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", | ||
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", | ||
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", | ||
"/install/vmlinuz<wait>", | ||
" auto<wait>", | ||
" console-setup/ask_detect=false<wait>", | ||
" console-setup/layoutcode=us<wait>", | ||
" console-setup/modelcode=pc105<wait>", | ||
" debconf/frontend=noninteractive<wait>", | ||
" debian-installer=en_US.UTF-8<wait>", | ||
" fb=false<wait>", | ||
" initrd=/install/initrd.gz<wait>", | ||
" kbd-chooser/method=us<wait>", | ||
" keyboard-configuration/layout=USA<wait>", | ||
" keyboard-configuration/variant=USA<wait>", | ||
" locale=en_US.UTF-8<wait>", | ||
" netcfg/get_domain=vm<wait>", | ||
" netcfg/get_hostname=vagrant<wait>", | ||
" grub-installer/bootdev=/dev/sda<wait>", | ||
" noapic<wait>", | ||
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>", | ||
" -- <wait>", | ||
"<enter><wait>" | ||
] | ||
boot_wait = "10s" | ||
disk_size = "${var.disk_size}" | ||
guest_os_type = "Ubuntu_64" | ||
hard_drive_interface = "sata" | ||
headless = "${var.headless}" | ||
http_directory = "../../http/ubuntu-20.04" | ||
iso_checksum = "${var.iso_checksum}" | ||
iso_urls = [ | ||
"iso/ubuntu-20.04.1-legacy-server-amd64.iso", | ||
"http://cdimage.ubuntu.com/ubuntu-legacy-server/releases/20.04/release/ubuntu-20.04.1-legacy-server-amd64.iso" | ||
] | ||
output_directory = "../../builds/virtualbox/vagrant-base-ubuntu-20.04-amd64" | ||
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now" | ||
ssh_password = "vagrant" | ||
ssh_port = 22 | ||
ssh_username = "vagrant" | ||
ssh_timeout = "10000s" | ||
vboxmanage = [ | ||
["modifyvm", "{{ .Name }}", "--memory", "${var.memory}"], | ||
["modifyvm", "{{ .Name }}", "--cpus", "${var.cpus}"] | ||
] | ||
virtualbox_version_file = ".vbox_version" | ||
vm_name = "${var.template}" | ||
} | ||
|
||
build { | ||
sources = [ | ||
"source.virtualbox-iso.ubuntu" | ||
] | ||
|
||
provisioner "shell" { | ||
environment_vars = [ | ||
"HOME_DIR=/home/vagrant", | ||
"http_proxy=${var.http_proxy}", | ||
"https_proxy=${var.https_proxy}", | ||
"no_proxy=${var.no_proxy}" | ||
] | ||
execute_command = "echo 'vagrant' | {{ .Vars }} sudo -S -E sh -eux '{{ .Path }}'" | ||
expect_disconnect = true | ||
scripts = [ | ||
"../../scripts/ubuntu/update.sh", | ||
"../../scripts/common/sshd.sh", | ||
"../../scripts/ubuntu/networking.sh", | ||
"../../scripts/ubuntu/sudoers.sh", | ||
"../../scripts/ubuntu/vagrant.sh", | ||
"../../scripts/common/virtualbox.sh", | ||
"../../scripts/ubuntu/cleanup.sh", | ||
"../../scripts/common/minimize.sh" | ||
] | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
packer/templates/vagrant-box-archivematica/template.json.pkr.hcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
packer { | ||
required_plugins { | ||
ansible = { | ||
source = "github.com/hashicorp/ansible" | ||
version = "~> 1" | ||
} | ||
vagrant = { | ||
source = "github.com/hashicorp/vagrant" | ||
version = "~> 1" | ||
} | ||
virtualbox = { | ||
source = "github.com/hashicorp/virtualbox" | ||
version = "~> 1" | ||
} | ||
} | ||
} | ||
|
||
source "virtualbox-ovf" "ubuntu" { | ||
headless = "true" | ||
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now" | ||
source_path = "../../builds/virtualbox/vagrant-base-ubuntu-20.04-amd64/vagrant-base-ubuntu-20.04-amd64.ovf" | ||
ssh_password = "vagrant" | ||
ssh_username = "vagrant" | ||
ssh_wait_timeout = "30s" | ||
} | ||
|
||
build { | ||
sources = [ | ||
"source.virtualbox-ovf.ubuntu" | ||
] | ||
|
||
provisioner "shell" { | ||
execute_command = "echo 'vagrant'|{{ .Vars }} sudo -S -E bash '{{ .Path }}'" | ||
scripts = [ | ||
"../../scripts/ubuntu/ansible-focal.sh" | ||
] | ||
} | ||
|
||
provisioner "ansible-local" { | ||
galaxy_file = "requirements.yml" | ||
group_vars = "./provisioning/group_vars/" | ||
inventory_groups = [ | ||
"servers" | ||
] | ||
playbook_file = "./provisioning/singlenode.yml" | ||
} | ||
|
||
provisioner "shell" { | ||
execute_command = "echo 'vagrant'|{{ .Vars }} sudo -S -E bash '{{ .Path }}'" | ||
scripts = [ | ||
"./motd.sh", | ||
"../../scripts/ubuntu/cleanup.sh", | ||
"../../scripts/common/minimize.sh" | ||
] | ||
} | ||
|
||
post-processor "vagrant" { | ||
output = "../../builds/{{ .Provider }}/vagrant-am.box" | ||
vagrantfile_template = "./Vagrantfile" | ||
} | ||
} |