Added Packer configuration for DigitalOcean

This commit is contained in:
Héctor Molinero Fernández 2020-08-15 17:55:40 +02:00
parent a89c9d9708
commit c61dc1bd53
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,7 @@
#cloud-config
ssh_pwauth: false
disable_root: false
runcmd:
- sed -i '/ssh_pwauth/d' /etc/cloud/cloud.cfg.d/*-digitalocean.cfg

View File

@ -18,6 +18,26 @@ source "hcloud" "main" {
ssh_timeout = "10m" ssh_timeout = "10m"
} }
source "digitalocean" "main" {
api_token = var.digitalocean_api_token
image = "ubuntu-20-04-x64"
droplet_name = "wireguard-{{timestamp}}"
size = "s-1vcpu-1gb"
region = "fra1"
snapshot_name = "wireguard-{{timestamp}}"
tags = [
"wireguard"
]
user_data_file = "./digitalocean/seed/user-data"
ssh_port = "22"
ssh_username = "root"
ssh_timeout = "10m"
}
source "qemu" "main" { source "qemu" "main" {
iso_url = "https://cloud-images.ubuntu.com/daily/server/focal/current/focal-server-cloudimg-amd64.img" iso_url = "https://cloud-images.ubuntu.com/daily/server/focal/current/focal-server-cloudimg-amd64.img"
iso_checksum = "file:https://cloud-images.ubuntu.com/daily/server/focal/current/SHA256SUMS" iso_checksum = "file:https://cloud-images.ubuntu.com/daily/server/focal/current/SHA256SUMS"

View File

@ -3,3 +3,9 @@ variable "hcloud_api_token" {
description = "Hetzner Cloud API token" description = "Hetzner Cloud API token"
default = "" default = ""
} }
variable "digitalocean_api_token" {
type = string
description = "DigitalOcean API token"
default = ""
}