Working block storage.

main
Thomas Hintz 2 weeks ago
parent 92325d3a19
commit d7f4fa7499

@ -7,6 +7,16 @@ passwd:
- ""
systemd:
units:
- name: appstorage.mount
enabled: true
contents: |
[Mount]
What=/dev/disk/by-label/appstorage
Where=/appstorage
Type=ext4
[Install]
RequiredBy=local-fs.target
- name: app.service
enabled: true
contents_local: app/app.service
@ -25,6 +35,10 @@ systemd:
ExecStartPost=/usr/bin/sh -c "if ! cmp --silent /tmp/docker-compose /tmp/docker-compose-new; then touch /run/reboot-required; fi"
storage:
filesystems:
- device: /dev/disk/by-label/appstorage
format: ext4
wipe_filesystem: false
files:
- path: /var/lb/caddy/Caddyfile
contents:

@ -71,6 +71,16 @@ resource "digitalocean_reserved_ip" "machine" {
region = digitalocean_droplet.machine[each.key].region
}
resource "digitalocean_volume" "machine" {
for_each = toset(var.machines)
region = var.datacenter
name = "${var.cluster_name}-${each.key}"
size = 30
initial_filesystem_type = "ext4"
initial_filesystem_label = "appstorage"
description = "persistent storage for docker apps"
}
resource "digitalocean_droplet" "machine" {
for_each = toset(var.machines)
name = "${var.cluster_name}-${each.key}"
@ -91,6 +101,12 @@ resource "digitalocean_reserved_ip_assignment" "machine" {
droplet_id = digitalocean_droplet.machine[each.key].id
}
resource "digitalocean_volume_attachment" "machine" {
for_each = toset(var.machines)
droplet_id = digitalocean_droplet.machine[each.key].id
volume_id = digitalocean_volume.machine[each.key].id
}
# data "ct_config" "machine-ignitions" {
# for_each = toset(var.machines)
# content = templatefile("${path.module}/cl/machine-${each.key}.yaml.tmpl", {

Loading…
Cancel
Save