@linode
Create Linode Images for use with Linode.
- Partner
- HCP Ready
Updated 6 months ago
- GitHub(opens in new tab)
Linode
Type: linode
Artifact BuilderId: packer.linode
The linode
Packer builder is able to create Linode
Images for
use with Linode. The builder takes a source image,
runs any provisioning necessary on the image after launching it, then snapshots
it into a reusable image. This reusable image can then be used as the
foundation of new servers that are launched within Linode.
The builder does not manage images. Once it creates an image, it is up to you to use it or delete it.
Configuration Reference
There are many configuration options available for the builder. They are segmented below into two categories: required and optional parameters. Within each category, the available configuration keys are alphabetized.
In addition to the options listed here, a communicator can be configured for this builder. In addition to the options defined there, a private key file can also be supplied to override the typical auto-generated key:
ssh_private_key_file
(string) - Path to a PEM encoded private key file to use to authenticate with SSH. The~
can be used in path and will be expanded to the home directory of current user.
Required
linode_token
(string) - The client TOKEN to use to access your account. Alternatively, you can set your token as an environment variable namedLINODE_TOKEN
. Saving the token in the environment or centralized vaults can reduce the risk of the token being leaked from the codebase.image
(string) - An Image ID to deploy the Disk from. Official Linode Images start withlinode/
, while user Images start withprivate/
. See images for more information on the Images available for use. Examples arelinode/debian9
,linode/fedora28
,linode/ubuntu18.04
,linode/arch
, andprivate/12345
.region
(string) - The id of the region to launch the Linode instance in. Images are available in all regions, but there will be less delay when deploying from the region where the image was taken. See regions for more information on the available regions. Examples areus-east
,us-central
,us-west
,ap-south
,ca-east
,ap-northeast
,eu-central
, andeu-west
.instance_type
(string) - The Linode type defines the pricing, CPU, disk, and RAM specs of the instance. See instance types for more information on the available Linode instance types. Examples areg6-nanode-1
,g6-standard-2
,g6-highmem-16
, andg6-dedicated-16
.
Optional
authorized_keys
(list) - Public SSH keys need to be appended to the Linode instance.authorized_users
(list) - Users whose SSH keys need to be appended to the Linode instance.instance_label
(string) - The name assigned to the Linode Instance.instance_tags
(list) - Tags to apply to the instance when it is created.swap_size
(int) - The disk size (MiB) allocated for swap space.interface
([#interface]) - Network Interfaces to add to this Linode’s Configuration Profile. Singular repeatable block containing apurpose
, alabel
, and anipam_address
field.image_label
(string) - The name of the resulting image that will appear in your account. Defaults topacker-{{timestamp}}
(see configuration templates for more info).image_description
(string) - The description of the resulting image that will appear in your account. Defaults to "".state_timeout
(string) - The time to wait, as a duration string, for the Linode instance to enter a desired state (such as "running") before timing out. The default state timeout is "5m".image_create_timeout
(string) - The time to wait, as a duration string, for the disk image to be created successfully before timing out. The default image creation timeout is "10m".private_ip
(bool) - If true, the created Linode will have private networking enabled and assigned a private IPv4 address.root_pass
(string) - The root password of the Linode instance for building the image. Please note that when you create a new Linode instance with a private image, you will be required to setup a new root password.
Interface
This section outlines the fields configurable for a single interface object.
purpose
(string) - The purpose of this interface. (public, vlan, vpc)primary
(bool) - Whether this interface is a primary interface.
VLAN-specific fields:
label
(string) - The label of the VLAN this interface relates to.ipam_address
(string) - This Network Interface’s private IP address in CIDR notation.
VPC-specific fields:
subnet_id
(int) - The ID of the VPC Subnet this interface references.ipv4
(block) - The IPv4 configuration of this VPC interface.vpc
(string) - The IPv4 address from the VPC subnet to use for this interface.nat_1_1
(string) - The public IPv4 address assigned to this Linode to be 1:1 NATed with the VPC IPv4 address.
Examples
Basic Example
Here is a Linode builder example. The linode_token
should be replaced with an
actual Linode Personal Access
Token
or in the config file or the environmental variable, LINODE_TOKEN
.
HCL2
JSON
Complicated Example
HCL2
JSON