Building Cloud images for Linode with Packer

YouTube player

First example

 {
   "variables": {
     "linode_api_token": ""
   },
 
 
   "builders": [{
     "type": "linode",
     "linode_token": "Template:User `linode api token`",
     "image": "linode/debian10",
     "region": "us-east",
     "instance_type": "g6-nanode-1",
     "ssh_username": "root",
     "instance_label": "myserver-Template:Timestamp",
     "image_label": "my-image-Template:Timestamp",
     "image_description": "My first Packer image"
   }]
 }

Second example

 {
   "variables": {
     "linode_api_token": ""
   },
 
   "builders": [{
     "type": "linode",
     "linode_token": "Template:User `linode api token`",
     "image": "linode/debian10",
     "region": "us-east",
     "instance_type": "g6-nanode-1",
     "ssh_username": "root",
     "instance_label": "myserver-Template:Timestamp",
     "image_label": "my-image-Template:Timestamp",
     "image_description": "My first Packer image"
   }],
 
   "provisioners": [{
     "type": "shell",
     "script": "script.sh"
   }]
 
 }

Apache install script

 #!/bin/bash
 
 sudo apt update
 
 sudo apt install -y apache2