Working block storage.
This commit is contained in:
@@ -7,6 +7,16 @@ passwd:
|
|||||||
- ""
|
- ""
|
||||||
systemd:
|
systemd:
|
||||||
units:
|
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
|
- name: app.service
|
||||||
enabled: true
|
enabled: true
|
||||||
contents_local: app/app.service
|
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"
|
ExecStartPost=/usr/bin/sh -c "if ! cmp --silent /tmp/docker-compose /tmp/docker-compose-new; then touch /run/reboot-required; fi"
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
|
filesystems:
|
||||||
|
- device: /dev/disk/by-label/appstorage
|
||||||
|
format: ext4
|
||||||
|
wipe_filesystem: false
|
||||||
files:
|
files:
|
||||||
- path: /var/lb/caddy/Caddyfile
|
- path: /var/lb/caddy/Caddyfile
|
||||||
contents:
|
contents:
|
||||||
|
|||||||
16
main.tf
16
main.tf
@@ -71,6 +71,16 @@ resource "digitalocean_reserved_ip" "machine" {
|
|||||||
region = digitalocean_droplet.machine[each.key].region
|
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" {
|
resource "digitalocean_droplet" "machine" {
|
||||||
for_each = toset(var.machines)
|
for_each = toset(var.machines)
|
||||||
name = "${var.cluster_name}-${each.key}"
|
name = "${var.cluster_name}-${each.key}"
|
||||||
@@ -91,6 +101,12 @@ resource "digitalocean_reserved_ip_assignment" "machine" {
|
|||||||
droplet_id = digitalocean_droplet.machine[each.key].id
|
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" {
|
# data "ct_config" "machine-ignitions" {
|
||||||
# for_each = toset(var.machines)
|
# for_each = toset(var.machines)
|
||||||
# content = templatefile("${path.module}/cl/machine-${each.key}.yaml.tmpl", {
|
# content = templatefile("${path.module}/cl/machine-${each.key}.yaml.tmpl", {
|
||||||
|
|||||||
Reference in New Issue
Block a user