Skip to content

Instantly share code, notes, and snippets.

@t0mk
Created July 10, 2019 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save t0mk/30ee8807724c063e095da315cf516381 to your computer and use it in GitHub Desktop.
Save t0mk/30ee8807724c063e095da315cf516381 to your computer and use it in GitHub Desktop.
locals {
project_id = "408b7fd3-0df2-4837-b0df-65aaf09f642a"
ud = <<EOS
#cloud-config
coreos:
units:
- name: "docker-prometheus-node-exporter.service"
command: "start"
content: |
[Unit]
Description=Prometheus node exporter
Author=Me
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker run --name pne --net="host" --pid="host" -v "/:/host:ro,rslave" quay.io/prometheus/node-exporter --path.rootfs /host
ExecStop=/usr/bin/docker rm -f pne
EOS
}
output "ud" {
value = "${local.ud}"
}
resource "packet_device" "d1" {
hostname = "d1"
plan = "t1.small.x86"
facilities = ["sjc1"]
operating_system = "coreos_stable"
billing_cycle = "hourly"
project_id = "${local.project_id}"
user_data = "${local.ud}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment