Packer
Anka
@veertuinc
This is a packer plugin for building macOS VM templates and tags using the Anka Virtualization CLI
- Community
Updated 2 weeks ago
- GitHub(opens in new tab)
Anka Build Cloud Registry Push
Type: veertu-anka-registry-push
The veertu-anka-registry-push Packer Post Processor is able to push your created Anka VM templates to the Anka Build Cloud Registry through the Anka Virtualization package.
This post-processor is part of the Veertu Anka plugin. To install this plugin using packer init, add the following Packer block to your hcl template:
packer {
required_plugins {
veertu-anka = {
version = "= 4.x.x"
source = "github.com/veertuinc/veertu-anka"
}
}
}
Configuration Reference
There are many configuration options available for the post-processor. They are segmented below into two categories: required and optional parameters.
Required Configuration
type(String) Must beveertu-anka-registry-push; no other types
Optional Configuration
cacert(String) Path to a CA Root certificate.cert(String) Path to your node certificate (if certificate authority is enabled).description(String) The description of the tag.insecure(Boolean) Skip TLS verification.key(String) Path to your node certificate key if the client/node certificate doesn't contain one.local(Boolean) Assign a tag to your local template and avoid pushing to the Registry.remote(String) The registry URL or name to target for registry operation (will use your default configuration if not set).remote_vm(String) The name of a registry template you want to push the local template onto.tag(String) The name of the tag to push (will default as 'latest' if not set).force(Boolean) Whether or not to forcefully push, regardless of a tag already existingdelete_template_post_push(Boolean) Whentrue, after a successful remote registry push (localmust befalse) the post-processor runsanka delete --yeson the local VM template from the Anka builder (artifactname). It does not run forlocal = true(local tagging only). Defaults tofalse. Use this to avoid leaving duplicate local templates when reusing the samevm_nameacross builds. If deletion fails, the post-processor returns an error even though the push already succeeded.
Other
When using packer build -force, the post-processor will issue a revert API call to remove the existing tag before pushing the new.
Example
Here is an example that uses the file and shell provisioners.
variable "source_vm_name" {
type = string
default = "anka-packer-base-macos"
}
variable "vm_name" {
type = string
default = "anka-packer-from-source"
}
source "veertu-anka-vm-clone" "clone" {
vm_name = "${var.vm_name}"
source_vm_name = "${var.source_vm_name}"
}
build {
sources = [
"source.veertu-anka-vm-clone.clone",
]
provisioner "file" {
destination = "/private/tmp/"
source = "./examples/ansible"
}
provisioner "shell" {
inline = [
"[[ ! -d /tmp/ansible ]] && exit 100",
"touch /tmp/ansible/test1"
]
}
post-processor "veertu-anka-registry-push" {
tag = "v2"
delete_template_post_push = true
}
}