Switch from coreos to nixos

This commit is contained in:
2025-04-25 15:08:56 +10:00
parent 472b198618
commit 793d77dce9
51 changed files with 2874 additions and 5 deletions

View File

@@ -0,0 +1,5 @@
#! /bin/sh
rpm -qa | grep -qw butane || dnf install butane
butane --pretty --strict jaglan-beta-m40.bu --files-dir . --output jaglan-beta-m40.ign
butane --pretty --strict jaglan-beta-m41.bu --files-dir . --output jaglan-beta-m41.ign
butane --pretty --strict jaglan-beta-m42.bu --files-dir . --output jaglan-beta-m42.ign

View File

@@ -0,0 +1,5 @@
datacenter = "jaglan-beta"
data_dir = "/opt/consul"
encrypt = "5L5cOnGhQ63EUMqPtn4tYDb1XafmmbQx2n6WqPkqeFs=" # This is a secret that should be generated with `consul keygen`
retry_join = ["jaglan-beta-m01", "jaglan-beta-m40", "jaglan-beta-m41", "jaglan-beta-m42"]
server = true

View File

@@ -0,0 +1,9 @@
datacenter = "jaglan-beta"
data_dir = "/opt/nomad/data"
client {
enabled = true
}
server {
enabled = true
}

View File

@@ -0,0 +1,13 @@
[hashicorp]
name=Hashicorp Stable - $basearch
baseurl=https://rpm.releases.hashicorp.com/fedora/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://rpm.releases.hashicorp.com/gpg
[hashicorp-test]
name=Hashicorp Test - $basearch
baseurl=https://rpm.releases.hashicorp.com/fedora/$releasever/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://rpm.releases.hashicorp.com/gpg

View File

@@ -0,0 +1,56 @@
variant: fcos
version: 1.5.0
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJwojmm5GUDQTt/ic1w3yf5c0fyiPqhy8D9Y4qMVljEA othrayte@gmail.com
# We need to make users for consul and nomad as we need them before their installed
- name: consul
no_create_home: true
- name: nomad
no_create_home: true
systemd:
units:
- name: rpm-ostree-install-hashistack.service
enabled: true
contents_local: /units/rpm-ostree-install-hashistack.service
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: jaglan-beta-m40
- path: /etc/yum.repos.d/hashicorp.repo
contents:
local: /etc/yum.repos.d/hashicorp.repo
mode: 0644
- path: /etc/consul.d/consul.hcl
contents:
local: /etc/consul.d/consul.hcl
mode: 0600
group:
name: consul
user:
name: consul
- path: /etc/nomad.d/nomad.hcl
contents:
local: /etc/nomad.d/nomad.hcl
mode: 0600
group:
name: nomad
user:
name: nomad
directories:
- path: /opt/consul
mode: 0700
user:
name: consul
group:
name: consul
- path: /opt/nomad/data
mode: 0700
user:
name: nomad
group:
name: nomad

View File

@@ -0,0 +1,102 @@
{
"ignition": {
"version": "3.4.0"
},
"passwd": {
"users": [
{
"name": "core",
"sshAuthorizedKeys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJwojmm5GUDQTt/ic1w3yf5c0fyiPqhy8D9Y4qMVljEA othrayte@gmail.com"
]
},
{
"name": "consul",
"noCreateHome": true
},
{
"name": "nomad",
"noCreateHome": true
}
]
},
"storage": {
"directories": [
{
"group": {
"name": "consul"
},
"path": "/opt/consul",
"user": {
"name": "consul"
},
"mode": 448
},
{
"group": {
"name": "nomad"
},
"path": "/opt/nomad/data",
"user": {
"name": "nomad"
},
"mode": 448
}
],
"files": [
{
"path": "/etc/hostname",
"contents": {
"compression": "",
"source": "data:,jaglan-beta-m40"
},
"mode": 420
},
{
"path": "/etc/yum.repos.d/hashicorp.repo",
"contents": {
"compression": "gzip",
"source": "data:;base64,H4sIAAAAAAAC/7SPPcvCQBCE+/sVKdIm+76tkN5eO7HYXMY7ydexuwr+e4kfZ2EjgtXOMvAMzy6yxqOfJe3dxCOa9fMvNsbtgKIqypYVLD66JZxkaKJZ0hWRpLEWDGCF1plU+3mkA7pZmMpHfYZQ5pDe0A7Tcrrm34UUfITv77HH5ZOJkIJzL4HKoPZmsYXaTxyWtWzw97XBNQAA//9Dsu7agQEAAA=="
},
"mode": 420
},
{
"group": {
"name": "consul"
},
"path": "/etc/consul.d/consul.hcl",
"user": {
"name": "consul"
},
"contents": {
"compression": "gzip",
"source": "data:;base64,H4sIAAAAAAAC/1SPPU/DMBRFd/+KK7NSlZa2WzY+FhCtBAKEUPviPGK3yXNjvwD596hhgfWc4d5TkZJjUU4oYPdUNySTkpWsOaltFUYxjUeduii5b6xhcWk46okv75buQW79ZnV5/XTfrVUW+npVzl7oo23LzfdcVs/d+tDxTS4szvDoQ0bIIGR2iRXqSZF97JsKJaNm4UTKFb6Ceux+J3HgoWbZmcSahu0+BkGBt793J+3FzJ7jP1rM7bvJnD7HOk09m58AAAD//+J027nwAAAA"
},
"mode": 384
},
{
"group": {
"name": "nomad"
},
"path": "/etc/nomad.d/nomad.hcl",
"user": {
"name": "nomad"
},
"contents": {
"compression": "gzip",
"source": "data:;base64,H4sIAAAAAAAC/2zJMQ7DIAwF0N2nsNgrTsBZKoO/KipqKtfNEuXuEZmzvqcS0mAB58LpLa8h9qgISbTqqf2KPL+RbX5E8+JE1EaHBe/EDJM6oFw4/A866Aff4Pd3BgAA///Bwum4cQAAAA=="
},
"mode": 384
}
]
},
"systemd": {
"units": [
{
"contents": "[Unit]\nDescription=Layer nomad \u0026 consul with rpm-ostree\nWants=network-online.target\nAfter=network-online.target\n# We run before `zincati.service` to avoid conflicting rpm-ostree\n# transactions.\nBefore=zincati.service\nConditionPathExists=!/var/lib/%N.stamp\n\n[Service]\nType=oneshot\nRemainAfterExit=yes\n# `--allow-inactive` ensures that rpm-ostree does not return an error\n# if the package is already installed. This is useful if the package is\n# added to the root image in a future Fedora CoreOS release as it will\n# prevent the service from failing.\nExecStart=/usr/bin/rpm-ostree install --apply-live --allow-inactive consul nomad\nExecStart=systemctl enable consul nomad\nExecStart=/bin/touch /var/lib/%N.stamp\nExecStart=systemctl reboot\n\n[Install]\nWantedBy=multi-user.target",
"enabled": true,
"name": "rpm-ostree-install-hashistack.service"
}
]
}
}

View File

@@ -0,0 +1,56 @@
variant: fcos
version: 1.5.0
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJwojmm5GUDQTt/ic1w3yf5c0fyiPqhy8D9Y4qMVljEA othrayte@gmail.com
# We need to make users for consul and nomad as we need them before their installed
- name: consul
no_create_home: true
- name: nomad
no_create_home: true
systemd:
units:
- name: rpm-ostree-install-hashistack.service
enabled: true
contents_local: /units/rpm-ostree-install-hashistack.service
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: jaglan-beta-m41
- path: /etc/yum.repos.d/hashicorp.repo
contents:
local: /etc/yum.repos.d/hashicorp.repo
mode: 0644
- path: /etc/consul.d/consul.hcl
contents:
local: /etc/consul.d/consul.hcl
mode: 0600
group:
name: consul
user:
name: consul
- path: /etc/nomad.d/nomad.hcl
contents:
local: /etc/nomad.d/nomad.hcl
mode: 0600
group:
name: nomad
user:
name: nomad
directories:
- path: /opt/consul
mode: 0700
user:
name: consul
group:
name: consul
- path: /opt/nomad/data
mode: 0700
user:
name: nomad
group:
name: nomad

View File

@@ -0,0 +1,102 @@
{
"ignition": {
"version": "3.4.0"
},
"passwd": {
"users": [
{
"name": "core",
"sshAuthorizedKeys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJwojmm5GUDQTt/ic1w3yf5c0fyiPqhy8D9Y4qMVljEA othrayte@gmail.com"
]
},
{
"name": "consul",
"noCreateHome": true
},
{
"name": "nomad",
"noCreateHome": true
}
]
},
"storage": {
"directories": [
{
"group": {
"name": "consul"
},
"path": "/opt/consul",
"user": {
"name": "consul"
},
"mode": 448
},
{
"group": {
"name": "nomad"
},
"path": "/opt/nomad/data",
"user": {
"name": "nomad"
},
"mode": 448
}
],
"files": [
{
"path": "/etc/hostname",
"contents": {
"compression": "",
"source": "data:,jaglan-beta-m41"
},
"mode": 420
},
{
"path": "/etc/yum.repos.d/hashicorp.repo",
"contents": {
"compression": "gzip",
"source": "data:;base64,H4sIAAAAAAAC/7SPPcvCQBCE+/sVKdIm+76tkN5eO7HYXMY7ydexuwr+e4kfZ2EjgtXOMvAMzy6yxqOfJe3dxCOa9fMvNsbtgKIqypYVLD66JZxkaKJZ0hWRpLEWDGCF1plU+3mkA7pZmMpHfYZQ5pDe0A7Tcrrm34UUfITv77HH5ZOJkIJzL4HKoPZmsYXaTxyWtWzw97XBNQAA//9Dsu7agQEAAA=="
},
"mode": 420
},
{
"group": {
"name": "consul"
},
"path": "/etc/consul.d/consul.hcl",
"user": {
"name": "consul"
},
"contents": {
"compression": "gzip",
"source": "data:;base64,H4sIAAAAAAAC/1SPPU/DMBRFd/+KK7NSlZa2WzY+FhCtBAKEUPviPGK3yXNjvwD596hhgfWc4d5TkZJjUU4oYPdUNySTkpWsOaltFUYxjUeduii5b6xhcWk46okv75buQW79ZnV5/XTfrVUW+npVzl7oo23LzfdcVs/d+tDxTS4szvDoQ0bIIGR2iRXqSZF97JsKJaNm4UTKFb6Ceux+J3HgoWbZmcSahu0+BkGBt793J+3FzJ7jP1rM7bvJnD7HOk09m58AAAD//+J027nwAAAA"
},
"mode": 384
},
{
"group": {
"name": "nomad"
},
"path": "/etc/nomad.d/nomad.hcl",
"user": {
"name": "nomad"
},
"contents": {
"compression": "gzip",
"source": "data:;base64,H4sIAAAAAAAC/2zJMQ7DIAwF0N2nsNgrTsBZKoO/KipqKtfNEuXuEZmzvqcS0mAB58LpLa8h9qgISbTqqf2KPL+RbX5E8+JE1EaHBe/EDJM6oFw4/A866Aff4Pd3BgAA///Bwum4cQAAAA=="
},
"mode": 384
}
]
},
"systemd": {
"units": [
{
"contents": "[Unit]\nDescription=Layer nomad \u0026 consul with rpm-ostree\nWants=network-online.target\nAfter=network-online.target\n# We run before `zincati.service` to avoid conflicting rpm-ostree\n# transactions.\nBefore=zincati.service\nConditionPathExists=!/var/lib/%N.stamp\n\n[Service]\nType=oneshot\nRemainAfterExit=yes\n# `--allow-inactive` ensures that rpm-ostree does not return an error\n# if the package is already installed. This is useful if the package is\n# added to the root image in a future Fedora CoreOS release as it will\n# prevent the service from failing.\nExecStart=/usr/bin/rpm-ostree install --apply-live --allow-inactive consul nomad\nExecStart=systemctl enable consul nomad\nExecStart=/bin/touch /var/lib/%N.stamp\nExecStart=systemctl reboot\n\n[Install]\nWantedBy=multi-user.target",
"enabled": true,
"name": "rpm-ostree-install-hashistack.service"
}
]
}
}

View File

@@ -0,0 +1,56 @@
variant: fcos
version: 1.5.0
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJwojmm5GUDQTt/ic1w3yf5c0fyiPqhy8D9Y4qMVljEA othrayte@gmail.com
# We need to make users for consul and nomad as we need them before their installed
- name: consul
no_create_home: true
- name: nomad
no_create_home: true
systemd:
units:
- name: rpm-ostree-install-hashistack.service
enabled: true
contents_local: /units/rpm-ostree-install-hashistack.service
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: jaglan-beta-m42
- path: /etc/yum.repos.d/hashicorp.repo
contents:
local: /etc/yum.repos.d/hashicorp.repo
mode: 0644
- path: /etc/consul.d/consul.hcl
contents:
local: /etc/consul.d/consul.hcl
mode: 0600
group:
name: consul
user:
name: consul
- path: /etc/nomad.d/nomad.hcl
contents:
local: /etc/nomad.d/nomad.hcl
mode: 0600
group:
name: nomad
user:
name: nomad
directories:
- path: /opt/consul
mode: 0700
user:
name: consul
group:
name: consul
- path: /opt/nomad/data
mode: 0700
user:
name: nomad
group:
name: nomad

View File

@@ -0,0 +1,102 @@
{
"ignition": {
"version": "3.4.0"
},
"passwd": {
"users": [
{
"name": "core",
"sshAuthorizedKeys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJwojmm5GUDQTt/ic1w3yf5c0fyiPqhy8D9Y4qMVljEA othrayte@gmail.com"
]
},
{
"name": "consul",
"noCreateHome": true
},
{
"name": "nomad",
"noCreateHome": true
}
]
},
"storage": {
"directories": [
{
"group": {
"name": "consul"
},
"path": "/opt/consul",
"user": {
"name": "consul"
},
"mode": 448
},
{
"group": {
"name": "nomad"
},
"path": "/opt/nomad/data",
"user": {
"name": "nomad"
},
"mode": 448
}
],
"files": [
{
"path": "/etc/hostname",
"contents": {
"compression": "",
"source": "data:,jaglan-beta-m42"
},
"mode": 420
},
{
"path": "/etc/yum.repos.d/hashicorp.repo",
"contents": {
"compression": "gzip",
"source": "data:;base64,H4sIAAAAAAAC/7SPPcvCQBCE+/sVKdIm+76tkN5eO7HYXMY7ydexuwr+e4kfZ2EjgtXOMvAMzy6yxqOfJe3dxCOa9fMvNsbtgKIqypYVLD66JZxkaKJZ0hWRpLEWDGCF1plU+3mkA7pZmMpHfYZQ5pDe0A7Tcrrm34UUfITv77HH5ZOJkIJzL4HKoPZmsYXaTxyWtWzw97XBNQAA//9Dsu7agQEAAA=="
},
"mode": 420
},
{
"group": {
"name": "consul"
},
"path": "/etc/consul.d/consul.hcl",
"user": {
"name": "consul"
},
"contents": {
"compression": "gzip",
"source": "data:;base64,H4sIAAAAAAAC/1SPPU/DMBRFd/+KK7NSlZa2WzY+FhCtBAKEUPviPGK3yXNjvwD596hhgfWc4d5TkZJjUU4oYPdUNySTkpWsOaltFUYxjUeduii5b6xhcWk46okv75buQW79ZnV5/XTfrVUW+npVzl7oo23LzfdcVs/d+tDxTS4szvDoQ0bIIGR2iRXqSZF97JsKJaNm4UTKFb6Ceux+J3HgoWbZmcSahu0+BkGBt793J+3FzJ7jP1rM7bvJnD7HOk09m58AAAD//+J027nwAAAA"
},
"mode": 384
},
{
"group": {
"name": "nomad"
},
"path": "/etc/nomad.d/nomad.hcl",
"user": {
"name": "nomad"
},
"contents": {
"compression": "gzip",
"source": "data:;base64,H4sIAAAAAAAC/2zJMQ7DIAwF0N2nsNgrTsBZKoO/KipqKtfNEuXuEZmzvqcS0mAB58LpLa8h9qgISbTqqf2KPL+RbX5E8+JE1EaHBe/EDJM6oFw4/A866Aff4Pd3BgAA///Bwum4cQAAAA=="
},
"mode": 384
}
]
},
"systemd": {
"units": [
{
"contents": "[Unit]\nDescription=Layer nomad \u0026 consul with rpm-ostree\nWants=network-online.target\nAfter=network-online.target\n# We run before `zincati.service` to avoid conflicting rpm-ostree\n# transactions.\nBefore=zincati.service\nConditionPathExists=!/var/lib/%N.stamp\n\n[Service]\nType=oneshot\nRemainAfterExit=yes\n# `--allow-inactive` ensures that rpm-ostree does not return an error\n# if the package is already installed. This is useful if the package is\n# added to the root image in a future Fedora CoreOS release as it will\n# prevent the service from failing.\nExecStart=/usr/bin/rpm-ostree install --apply-live --allow-inactive consul nomad\nExecStart=systemctl enable consul nomad\nExecStart=/bin/touch /var/lib/%N.stamp\nExecStart=systemctl reboot\n\n[Install]\nWantedBy=multi-user.target",
"enabled": true,
"name": "rpm-ostree-install-hashistack.service"
}
]
}
}

View File

@@ -0,0 +1,3 @@
1. Ensure butane is installed `dnf install butane`
2. Compile butane files into ignition files
`butane --pretty --strict jaglan-beta-m42.bu --files-dir . --output jaglan-beta-m42.ign`

View File

@@ -0,0 +1,23 @@
[Unit]
Description=Layer nomad & consul with rpm-ostree
Wants=network-online.target
After=network-online.target
# We run before `zincati.service` to avoid conflicting rpm-ostree
# transactions.
Before=zincati.service
ConditionPathExists=!/var/lib/%N.stamp
[Service]
Type=oneshot
RemainAfterExit=yes
# `--allow-inactive` ensures that rpm-ostree does not return an error
# if the package is already installed. This is useful if the package is
# added to the root image in a future Fedora CoreOS release as it will
# prevent the service from failing.
ExecStart=/usr/bin/rpm-ostree install --apply-live --allow-inactive consul nomad
ExecStart=systemctl enable consul nomad
ExecStart=/bin/touch /var/lib/%N.stamp
ExecStart=systemctl reboot
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,24 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/dmacvicar/libvirt" {
version = "0.7.6"
constraints = "0.7.6"
hashes = [
"h1:mmbm4vTyC/DCGO4Ed/vbp5AKvy1gmVn/94fzB9VmR08=",
"zh:0bde54f6f658b20b620b875daf106b5b25b1bae4d15408d6c5f06d58360e254d",
"zh:0c97c6930015918b8a34b6d7a2b0c3d17a649c226fcd1874fcba5bbbc0f35972",
"zh:1bdd7aa0011c5f024a09a124836ee9bc8e71b05a6ece810c61824275fd3f695f",
"zh:2b0cc7c794e4caf395d84ffff0b380d17e4b3219a4696264271bfe5059450efe",
"zh:2f8633f7fe07f76c188836ed6f93321ec5fbf5c004bc7699e1741d9b21ed5f37",
"zh:5bf47eed286ce55ed10a5cf657de49a34ab21cc8677c56fef3aab69cdde41a27",
"zh:7dca790fc5fd1d42bc4bc7170be003a7093602026d0f95c8aab84ad551fdf2a4",
"zh:80476b68bc84e3d661d1390025f83879b88f9cdc836de9751af09bd5716089cb",
"zh:82f3e2f3f50176cd6041c8ba36e295cbda1b289ef52ab75b5eceb0f921f64f7b",
"zh:a179b165f3b9bb9a67ebbbf9d73157ded33f02d476b2f58906389dca03b653c9",
"zh:acae54a5d0616f22b3180ddd8e8aad39af664e604394fdacf1f7b337bca2d5b4",
"zh:da4406a2428a9a7e98272c032cb93431c3919253af2fe9934b532d26c0deab09",
"zh:f63dbd8e579ab5268d01ffab4503b8a8e736b70d1a04e4f271559ba8dd133dcd",
"zh:f85c1d9e51a94ecde137435c9d6b0fb7be590437ea8a725334d1577eebbc550c",
]
}

View File

@@ -0,0 +1,95 @@
## 0.5.1 (December 14, 2018)
### HIGHLIGHTS:
- The provider will retry HTTP downloads if they were caused by server errors (https://github.com/dmacvicar/terraform-provider-libvirt/pull/479)
- XSLT can be used to transform the libvirt XML definition before creating resources, allowing to enable features the provider does not support (https://github.com/dmacvicar/terraform-provider-libvirt/pull/431)
- volumes: when the _HEAD_ method is forbidden, the provider will try a body-less _GET_ instead (https://github.com/dmacvicar/terraform-provider-libvirt/pull/472)
- network: add support for updating _dns.hosts_ (https://github.com/dmacvicar/terraform-provider-libvirt/pull/469)
- network: add support for setting _SRV_ entries (https://github.com/dmacvicar/terraform-provider-libvirt/pull/460)
- qemu-agent: do not contact the qemu agent if the domain is shutdown (https://github.com/dmacvicar/terraform-provider-libvirt/pull/474)
- cli: add `-version` flag (https://github.com/dmacvicar/terraform-provider-libvirt/pull/444)
## 0.5 (October 10, 2018)
### HIGHLIGHTS:
#### libvirt Domain
* _cloud_init_ resource is obsolete and replaced with _cloud_init_disk_ (https://github.com/dmacvicar/terraform-provider-libvirt/pull/410)
The resource does not allow individual fields anymore, and directly takes the _user_data_, _network_config_ and _meta_data_ fields, which you can provide directly or reading from a file, optionally using a _template_ resource and the rendered function. See the [updated documentation](https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/cloudinit.html.markdown).
#### Volumes/Disk/Storage
* Allow to set the size of a volume larger than its backing volume, which allows to resize the partition then using _cloud-init_, and not be limited by the backing image (#369 and #357).
## 0.4.4 (September 16, 2018)
### HIGHLIGHTS:
#### libvirt Domain
* `TF_USE_QEMU_AGENT` variable is deprecated and replaced by a domain property `qemu_agent`.
Because variables can be interpolated into properties, and variables can be [passed via environment variables](https://www.terraform.io/docs/configuration/environment-variables.html#tf_var_name), the old behavior can be emulated.
#### Volumes/Disk/Storage
* Automatic disk driver selection based on volume format and automatic volume format detection(https://github.com/dmacvicar/terraform-provider-libvirt/commit/676b5a3fec75664990e5a91f24859f35becdee6a)
#### Networking
* `dhcp` paramater is an optional parameter now, disabled by default. (https://github.com/dmacvicar/terraform-provider-libvirt/pull/385)
* DNS forwarders were reworked. `localonly` option was added to libvirt-network (https://github.com/dmacvicar/terraform-provider-libvirt/commit/7651ee5824f77f0c7485736315d5a24762f85e60)
* A datasource called `libvirt_network_dns_hosts_template` can be used to populate the `dns_host` attribute in `libvirt_network` resources. (https://github.com/dmacvicar/terraform-provider-libvirt/commit/a4d0ba6a319d8728cb5d6c10aae593bdd27da516)
___
#### General improvements
* Acceptance tests are now idempotent (no dependency between resource of various tests), which avoids cascade failures. (several PRs and commits)
* Project dependencies were updated ( https://github.com/dmacvicar/terraform-provider-libvirt/commit/1347e7cabbe68d93f7cc065339636854d7c7d340)
* The error message when uploading a volume fails was improved (https://github.com/dmacvicar/terraform-provider-libvirt/commit/1aec44e0c990c4edb22578125bae33f92c4a4f39)
___
#### Bugs
* `netIface["bridge"]` now uses the correct value (https://github.com/dmacvicar/terraform-provider-libvirt/commit/2e93c78b2aea17b48639b3d613f12bfad851fd52)
## 0.4.3 (August 14, 2018)
HIGHLIGHTS:
* *IMPORTANT* qemu-agent is not used by default to gather network
interface information anymore. If you need to use, please set
the TF_USE_QEMU_AGENT environment variable.
* Handle gracefully out-of-band destruction of volume and cloud-init
resources. Should provide a better end-user experience in day to day
operations.
## 0.4.2 (August 3, 2018)
HIGHLIGHTS:
* Fix crashes when using network devices not associated with a
network name (regression introduced in 0.4)
## 0.4.1 (July 28, 2018)
HIGHLIGHTS:
* Fix broken ip address detection bug that was introduced in 0.4
* Add support for importing domain, network, volumes (#336)
## 0.4 (July 25, 2018)
HIGHLIGHTS:
* Support for multiple provider instances (ie: hypervisors) with different URIs
* Support for keyword-less and nested equal signs in kernel parameters
* Adds the `running` attribute when creating a domain
* Fix a bug with UEFI/OVMF booting on remote hypervisors
* Update the project dependencies to more recent versions
* The project now provides builds
* The project now has a gitter.im channel
* Integration tests are fixed and working again

View File

@@ -0,0 +1,174 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

View File

@@ -0,0 +1,154 @@
# Terraform provider for libvirt
- [![Gitter chat](https://badges.gitter.im/terraform-provider-libvirt/Lobby.png)](https://gitter.im/terraform-provider-libvirt/Lobby) ([IRC gateway](https://irc.gitter.im/))
- Planning board: [Github Projects](https://github.com/dmacvicar/terraform-provider-libvirt/projects/1)
![alpha](https://img.shields.io/badge/stability%3F-beta-yellow.svg) [![Tests](https://github.com/dmacvicar/terraform-provider-libvirt/actions/workflows/test.yml/badge.svg)](https://github.com/dmacvicar/terraform-provider-libvirt/actions/workflows/test.yml) [![Registry](https://img.shields.io/badge/libvirt-Terraform%20Registry-blue)](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs)
___
This is a terraform provider that lets you provision
servers on a [libvirt](https://libvirt.org/) host via [Terraform](https://terraform.io/).
## Introduction & Goals
This project exists:
* To allow teams to get the benefits [Software Defined Infrastructure](https://en.wikipedia.org/wiki/Software-defined_infrastructure) Terraform provides, on top of classical and cheap virtualization infrastructure provided by Linux and [KVM](https://www.linux-kvm.org)
This helps in very dynamic [DevOps](https://en.wikipedia.org/wiki/DevOps), Development and Testing activities.
* To allow for mixing KVM resources with other infrastructure Terraform is able to manage
What is *NOT* in scope:
* To support every advanced feature [libvirt](https://libvirt.org/) supports
This would make the mapping from terraform complicated and not maintainable. See the [How to contribute](CONTRIBUTING.md) section to understand how to approach new features.
## Getting started
The provider is available for auto-installation from the [Terraform Registry](https://registry.terraform.io/providers/dmacvicar/libvirt/latest).
In your `main.tf` file, specify the version you want to use:
```hcl
terraform {
required_providers {
libvirt = {
source = "dmacvicar/libvirt"
}
}
}
provider "libvirt" {
# Configuration options
}
```
And now run terraform init:
```console
$ terraform init
```
### Creating your first virtual machine
Here is an example that will setup the following:
+ A virtual server resource
(create this as main.tf and run terraform commands from this directory):
```hcl
provider "libvirt" {
uri = "qemu:///system"
}
```
You can also set the URI in the LIBVIRT_DEFAULT_URI environment variable.
Now, define a libvirt domain:
```hcl
resource "libvirt_domain" "terraform_test" {
name = "terraform_test"
}
```
Now you can see the plan, apply it, and then destroy the infrastructure:
```console
$ terraform init
$ terraform plan
$ terraform apply
$ terraform destroy
```
Look at more advanced examples [here](examples/) and check the [documentation](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs).
## Manual installation
You can also manually download the provider from the [releases section](https://github.com/dmacvicar/terraform-provider-libvirt/releases) on Github. To install it, refer to the [Terraform documentation](https://www.terraform.io/docs/cli/config/config-file.html#provider-installation).
## Building from source
- [Go](https://golang.org/doc/install) is required for building.
```bash
git clone https://github.com/dmacvicar/terraform-provider-libvirt.git
cd terraform-provider-libvirt
make
```
The binary will be called `terraform-provider-libvirt`.
### Using multiple hypervisors / provider instances
You can target different libvirt hosts instantiating the [provider multiple times](https://www.terraform.io/docs/configuration/providers.html#multiple-provider-instances). [Example](examples/v0.12/multiple).
### Using qemu-agent
From its documentation, [qemu-agent](https://wiki.libvirt.org/page/Qemu_guest_agent):
>It is a daemon program running inside the domain which is supposed to help management applications with executing functions which need assistance of the guest OS.
Until terraform-provider-libvirt 0.4.2, qemu-agent was used by default to get network configuration. However, if qemu-agent is not running, this creates a delay until connecting to it times-out.
In current versions, we default to not to attempt connecting to it, and attempting to retrieve network interface information from the agent needs to be enabled explicitly with `qemu_agent = true`, further details [here](https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/domain.html.markdown). Note that you still need to make sure the agent is running in the OS, and that is unrelated to this option.
Note: when using bridge network configurations you need to enable the `qemu_agent = true`. otherwise you will not retrieve the ip addresses of domains.
Be aware that this variables may be subject to change again in future versions.
## Upstream projects using terraform-libvirt:
* [sumaform](https://github.com/moio/sumaform)
sumaform is a way to quickly configure, deploy, test [Uyuni](https://www.uyuni-project.org/) and [SUSE Manager](https://www.suse.com/products/suse-manager/) setups with clients and servers.
* [ha-cluster-sap](https://github.com/SUSE/ha-sap-terraform-deployments)
Automated HA and SAP Deployments in Public/Private Clouds (including Libvirt/KVM)
* [ceph-open-terrarium](https://github.com/MalloZup/ceph-open-terrarium)
ceph-open-terrarium is a way to quickly configure, deploy, tests CEPH cluster without or with [Deepsea](https://github.com/SUSE/DeepSea)
* [kubic](https://github.com/kubic-project)
* [kubic-terraform-kvm](https://github.com/kubic-project/kubic-terraform-kvm) Kubic Terraform script using KVM/libvirt
* [Community Driven Docker Examples](contrib/)
Docker examples showing how to use the Libvirt Provider
* [Openshift 4 Installer](https://github.com/openshift/installer)
The Openshift 4 Installer uses Terraform for cluster orchestration and relies on terraform-provider-libvirt for
libvirt platform.
* [Kubitect](https://github.com/MusicDin/kubitect) - a CLI tool for deploying and managing Kubernetes clusters on libvirt platform.
## Authors
* Duncan Mac-Vicar P. <duncan@mac-vicar.eu>
See also the list of [contributors](https://github.com/dmacvicar/terraform-provider-libvirt/graphs/contributors) who participated in this project.
The structure and boilerplate is inspired from the [Softlayer](https://github.com/finn-no/terraform-provider-softlayer) and [Google](https://github.com/terraform-providers/terraform-provider-google) Terraform provider sources.
## License
* Apache 2.0, See LICENSE file

View File

@@ -0,0 +1,2 @@
unraid.othrayte.one ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAqk9L+GExUj58HEBBz9cTQ4BreTh01Nc0Nt2zqJqx/F
betelgeuse-seven-unraid ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAqk9L+GExUj58HEBBz9cTQ4BreTh01Nc0Nt2zqJqx/F

Binary file not shown.

View File

@@ -0,0 +1,3 @@
`terraform init`
`terraform plan --out plan.tfplan`
`terraform apply plan.tfplan`

View File

@@ -0,0 +1,33 @@
1. Download CoreOS "Live DVD" iso from https://fedoraproject.org/coreos/download?stream=stable#baremetal
For archival and for use in unraid these are stored at smb://betelgeuse-seven-unraid.local/isos
2. Boot ISO
On unraid
1. **VMS > ADD VM > Linux/CoreOS**
2. Set **OS Install ISO** to downloaded iso
3. Choose **Primary vDisk Size**, say 10GB (they recommend 8GiB min but 8GB is less than that)
3. Connect
On unraid: **VMS > (VM Icon, left click) > VM Console(VNC)**
4. Identify disk to install to
`sudo vdisk -l`, on unraid this was /dev/vda
5. Host the ignition file for the installer to see
Run `python3 -m http.server 8080` (from the folder with the ignition files)
6. Install CoreOS
1. Get the OS on disk for tshe first time
`sudo coreos-installer install /dev/vda --insecure-ignition --ignition-url http://192.168.1.115:8080/jaglan-beta-m42.ign`
2. Reboot to injest ignition file and provision
`sudo reboot`
ssh should now work with the user's ssh keys from ignition file
3. Wait, the initial service will install the hashistack and reboot again
4. Repeat for m41 and m40.
7. Boostrapping the consul cluster
1. Run `consul agent -bootstrap-expect 1 -bind 192.168.1.115 -ui -config-file ./etc/consul.d/consul.hcl` locally
2. Check the ui at http://localhost:8500/ui to ensure that the expected nodes are shown
8. Boostrapping the nomad cluster
1. Run `nomad agent -bootstrap-expect 1 -config ./etc/nomad.d/nomad.hcl` locally
2. Check the ui at http://localhost:4646/ui to ensure that the expected nodes are shown
# Useful Debugging Commands
`sudo systemctl start consul`
Read consul startup logs: `sudo journalctl -xeu consul.service`
Start the consul UI locally: `consul agent -bind 192.168.1.115 -ui -config-file ./etc/consul.d/consul.hcl`

View File

@@ -0,0 +1,161 @@
{
"version": 4,
"terraform_version": "1.6.4",
"serial": 79,
"lineage": "afff4b50-12a8-b1b7-406b-2f1a49714357",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "libvirt_domain",
"name": "default",
"provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"arch": "x86_64",
"autostart": false,
"boot_device": [
{
"dev": [
"hd"
]
}
],
"cloudinit": null,
"cmdline": null,
"console": [],
"coreos_ignition": null,
"cpu": [
{
"mode": "custom"
}
],
"description": "v0.3",
"disk": [
{
"block_device": "",
"file": "",
"scsi": false,
"url": "",
"volume_id": "/mnt/user/domains/terraform/test.qcow2",
"wwn": ""
}
],
"emulator": "/usr/bin/qemu-system-x86_64",
"filesystem": [],
"firmware": null,
"fw_cfg_name": "opt/com.coreos/config",
"graphics": [],
"id": "97fed2be-7162-4fea-8d7e-2d7cc35e8010",
"initrd": "",
"kernel": "",
"machine": "pc",
"memory": 1024,
"metadata": null,
"name": "test",
"network_interface": [],
"nvram": [],
"qemu_agent": false,
"running": true,
"timeouts": null,
"tpm": [],
"type": "kvm",
"vcpu": 1,
"video": [],
"xml": []
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==",
"dependencies": [
"libvirt_pool.terraform",
"libvirt_volume.default",
"libvirt_volume.fedora-coreos-39"
]
}
]
},
{
"mode": "managed",
"type": "libvirt_pool",
"name": "terraform",
"provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"allocation": 122744135680,
"available": 1877653749760,
"capacity": 2000397885440,
"id": "488a381a-3940-43fe-936e-4d0f80c4e9cf",
"name": "terraform",
"path": "/mnt/user/domains/terraform",
"type": "dir",
"xml": []
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "libvirt_volume",
"name": "default",
"provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"base_volume_id": "/mnt/user/domains/terraform/fedora-coreos-39.20231119.3.0-qemu.qcow2",
"base_volume_name": null,
"base_volume_pool": null,
"format": "qcow2",
"id": "/mnt/user/domains/terraform/test.qcow2",
"name": "test.qcow2",
"pool": "terraform",
"size": 10737418240,
"source": null,
"xml": []
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"libvirt_pool.terraform",
"libvirt_volume.fedora-coreos-39"
]
}
]
},
{
"mode": "managed",
"type": "libvirt_volume",
"name": "fedora-coreos-39",
"provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"base_volume_id": null,
"base_volume_name": null,
"base_volume_pool": null,
"format": "raw",
"id": "/mnt/user/domains/terraform/fedora-coreos-39.20231119.3.0-qemu.qcow2",
"name": "fedora-coreos-39.20231119.3.0-qemu.qcow2",
"pool": "terraform",
"size": 689573964,
"source": "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/39.20231119.3.0/x86_64/fedora-coreos-39.20231119.3.0-qemu.x86_64.qcow2.xz",
"xml": []
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"libvirt_pool.terraform"
]
}
]
}
],
"check_results": null
}

View File

@@ -0,0 +1,9 @@
{
"version": 4,
"terraform_version": "1.6.4",
"serial": 74,
"lineage": "afff4b50-12a8-b1b7-406b-2f1a49714357",
"outputs": {},
"resources": [],
"check_results": null
}

View File

@@ -0,0 +1,55 @@
terraform {
required_providers {
libvirt = {
source = "dmacvicar/libvirt"
version = "0.7.6"
}
}
}
provider "libvirt" {
uri = "qemu+ssh://root@betelgeuse-seven-unraid/system?&known_hosts_verify=ignore"
}
resource "libvirt_pool" "terraform" {
name = "terraform"
type = "dir"
path = "/mnt/user/domains/terraform"
}
# resource "libvirt_ignition" "ignition" {
# name = "example.ign"
# content = "../1-prepare-ignition-files/jaglan-beta-m40.ign"
# }
resource "libvirt_volume" "fedora-coreos-39" {
name = "fedora-coreos-39.20231119.3.0-qemu.qcow2"
pool = libvirt_pool.terraform.name
source = "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/39.20231119.3.0/x86_64/fedora-coreos-39.20231119.3.0-qemu.x86_64.qcow2.xz"
}
resource "libvirt_volume" "default" {
name = "test.qcow2"
pool = libvirt_pool.terraform.name
size = 10737418240 #10G
base_volume_id = libvirt_volume.fedora-coreos-39.id
}
resource "libvirt_domain" "default" {
name = "test"
description = "v0.3"
vcpu = 1
memory = 1024
#coreos_ignition = libvirt_ignition.ignition.id
disk {
volume_id = libvirt_volume.default.id
}
# disk {
# file = "/mnt/user/isos/fedora-coreos-39.20231119.3.0-qemu.x86_64.qcow2"
# }
# boot_device {
# dev = [ "hd"
# #, "cdrom"
# ]
# }
}

View File

@@ -0,0 +1,34 @@
# Local .terraform directories
**/.terraform/*
# .tfstate files
*.tfstate
*.tfstate.*
# Crash log files
crash.log
crash.*.log
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json
# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json
# Include override files you do wish to add to version control using negated pattern
# !example_override.tf
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
# Ignore CLI configuration files
.terraformrc
terraform.rc

View File

@@ -0,0 +1,25 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/neuspaces/system" {
version = "0.4.0"
constraints = "0.4.0"
hashes = [
"h1:Vsp3ZoNGUnijGxcyKPJAnjzaifk2rcOaA6DtS4Wsdyk=",
"zh:04862132feb60ff990e15f4b878e96fbcc296720bd31a39e7b0a8fe5788b5b33",
"zh:1d8b6050274b5b915fbf241a66c63fe1b2088bc4720e0ef36a3d75a197a97d78",
"zh:5263effc40349d48ed458ea5d418e7321db441d7987b35fabbdd3faa53ed114d",
"zh:5b13d535084dacba3d511d5c815db4b5ae83e9c6226938bbf20a30c4e05116cb",
"zh:69da944ea0c86ec4e64ae844f580d13910fd66f1d8a9ecc7890ff0ace29aef36",
"zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
"zh:7fce212ccf0fd267a7f318c793e174605cbaa7814f9b30be16ed1d0526ab398f",
"zh:97523ef340365bfaf759cc1eb4a202af7b27ac87e1cb5f0309a585d63e205bbd",
"zh:9f3fefa30abc39a1073e66b88701b5437f4b04b0082091408c97f6a8e5b64bd3",
"zh:e16d43079cc894bfb0980ff211ea1787cdb913f24826461a8967ac91fd146ea8",
"zh:e4630f531b59e813fa405942c7648252c741313ccd49bc1be85f2ea964016ed3",
"zh:ebd2549e8b5b2894efb0ba70f2f6034ae5fb5821d1e2831ba5af8fa5e5870829",
"zh:ed601fdbf4813d041b3773781e2331c7ea074f8a5b505d2b105059a89b44301c",
"zh:f08f8e3d05759b72421de4c54f6938396d3e13fdfdbe7505877b1c64342dfa3a",
"zh:fea9e0172235a52343826d77e8331bcfeb785d514b4f5ee39f524d541b1a8749",
]
}

View File

@@ -0,0 +1,35 @@
terraform {
required_providers {
system = {
source = "neuspaces/system"
version = "0.4.0"
}
}
}
provider "system" {
ssh {
host = "jaglan-beta-m42"
user = "core"
agent = true
}
}
resource "system_file" "static_content" {
path = "/etc/consul.d/consul.hcl"
content = "Hello world!"
}
resource "terraform_data" "jaglan-beta" {
provisioner "file" {
source = "consul.hcl"
#destination = "/etc/consul.d/consul.hcl"
destination = "./consul.hcl"
}
connection {
type = "ssh"
user = "core"
host = "jaglan-beta-m42"
}
}

View File

@@ -0,0 +1,24 @@
datacenter = "jaglan-beta"
#data_dir = "/var/lib/nomad"
#plugin_dir = "/usr/local/lib/nomad/plugins"
server {
enabled = true
bootstrap_expect = 1
server_join {
retry_join = ["jaglan-beta-m01", "jaglan-beta-m42"]
}
}
tls {
http = true
rpc = true
ca_file = "/etc/nomad.certs/nomad-ca.pem"
cert_file = "/etc/nomad.certs/server.pem"
key_file = "/etc/nomad.certs/server-key.pem"
verify_server_hostname = true
verify_https_client = true
}

Binary file not shown.

View File

@@ -0,0 +1,11 @@
We use terraform for this configuration step just to make it easier
to develop what the configuration should be, once it is stable we
can move it into the butane definition.
1. Generate secrets
1. consul `encrypt`, `consul keygen` and store in consul.hcl
2. nomad keys?
2. Init & apply terraform
1. `terraform init`
2. `terraform plan --out plan.tfplan`
3. `terraform apply plan.tfplan`