mirror of
https://github.com/apricote/home-cloud.git
synced 2026-02-06 17:57:02 +00:00
ansible setup
This commit is contained in:
parent
42ec743a00
commit
2a2d951971
24 changed files with 167 additions and 430 deletions
14
terraform_provider_test/Makefile
Normal file
14
terraform_provider_test/Makefile
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
TF=terraform
|
||||
TFFLAGS=-var-file=credentials.tfvars
|
||||
|
||||
apply: init
|
||||
$(TF) apply $(TFFLAGS)
|
||||
|
||||
plan: init
|
||||
$(TF) plan $(TFFLAGS)
|
||||
|
||||
destroy: init
|
||||
$(TF) destroy $(TFFLAGS)
|
||||
|
||||
init:
|
||||
$(TF) init
|
||||
60
terraform_provider_test/cluster.tf
Normal file
60
terraform_provider_test/cluster.tf
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
resource "rancher2_cluster" "sandbox" {
|
||||
name = "sandbox"
|
||||
description = "home-cloud sandbox cluster"
|
||||
kind = "rke"
|
||||
|
||||
rke_config {
|
||||
network {
|
||||
plugin = "canal"
|
||||
}
|
||||
|
||||
kubernetes_version = "v1.13.4-rancher1-1"
|
||||
|
||||
addons = <<ADDONS
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: hcloud-csi
|
||||
namespace: kube-system
|
||||
stringData:
|
||||
token: ${var.hcloud_token}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: hcloud
|
||||
namespace: kube-system
|
||||
stringData:
|
||||
token: ${var.hcloud_token}
|
||||
ADDONS
|
||||
|
||||
addons_include = [
|
||||
"https://raw.githubusercontent.com/kubernetes/csi-api/release-1.13/pkg/crd/manifests/csidriver.yaml",
|
||||
"https://raw.githubusercontent.com/kubernetes/csi-api/release-1.13/pkg/crd/manifests/csinodeinfo.yaml",
|
||||
"https://raw.githubusercontent.com/hetznercloud/csi-driver/master/deploy/kubernetes/hcloud-csi.yml",
|
||||
"https://raw.githubusercontent.com/hetznercloud/hcloud-cloud-controller-manager/master/deploy/v1.2.0.yaml",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
resource "rancher2_node_pool" "control" {
|
||||
cluster_id = "${rancher2_cluster.sandbox.id}"
|
||||
name = "control"
|
||||
hostname_prefix = "control"
|
||||
node_template_id = "user-x5qrl:nt-mdfr7"
|
||||
quantity = 1
|
||||
control_plane = true
|
||||
etcd = true
|
||||
worker = false
|
||||
}
|
||||
|
||||
resource "rancher2_node_pool" "compute" {
|
||||
cluster_id = "${rancher2_cluster.sandbox.id}"
|
||||
name = "compute"
|
||||
hostname_prefix = "compute"
|
||||
node_template_id = "user-x5qrl:nt-mdfr7"
|
||||
quantity = 1
|
||||
control_plane = false
|
||||
etcd = false
|
||||
worker = true
|
||||
}
|
||||
19
terraform_provider_test/nodes.tf
Normal file
19
terraform_provider_test/nodes.tf
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
resource rancher2_node_driver hcloud {
|
||||
active = true
|
||||
builtin = false
|
||||
description = "Hetzner Cloud"
|
||||
external_id = "hcloud"
|
||||
name = "hetzner"
|
||||
ui_url = "https://storage.googleapis.com/hcloud-rancher-v2-ui-driver/component.js"
|
||||
url = "https://github.com/JonasProgrammer/docker-machine-driver-hetzner/releases/download/1.2.2/docker-machine-driver-hetzner_1.2.2_linux_amd64.tar.gz"
|
||||
whitelist_domains = ["storage.googleapis.com"]
|
||||
}
|
||||
|
||||
resource hcloud_floating_ip cluster {
|
||||
type = "ipv4"
|
||||
home_location = "${var.hcloud_location}"
|
||||
}
|
||||
|
||||
output cluster_ip {
|
||||
value = "${hcloud_floating_ip.cluster.ip_address}"
|
||||
}
|
||||
12
terraform_provider_test/provider_hcloud.tf
Normal file
12
terraform_provider_test/provider_hcloud.tf
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# Set the variable value in *.tfvars file
|
||||
# or using -var="hcloud_token=..." CLI option
|
||||
variable "hcloud_token" {}
|
||||
|
||||
variable "hcloud_location" {}
|
||||
|
||||
# Configure the Hetzner Cloud Provider
|
||||
provider "hcloud" {
|
||||
version = "~> 1.7.0"
|
||||
|
||||
token = "${var.hcloud_token}"
|
||||
}
|
||||
17
terraform_provider_test/provider_rancher2.tf
Normal file
17
terraform_provider_test/provider_rancher2.tf
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
variable "rancher2_api_url" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "rancher2_access_key" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "rancher2_secret_key" {
|
||||
type = "string"
|
||||
}
|
||||
|
||||
provider "rancher2" {
|
||||
api_url = "${var.rancher2_api_url}"
|
||||
access_key = "${var.rancher2_access_key}"
|
||||
secret_key = "${var.rancher2_secret_key}"
|
||||
}
|
||||
3
terraform_provider_test/terraform.tfvars
Normal file
3
terraform_provider_test/terraform.tfvars
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
rancher2_api_url = "https://rancher.apricote.de/v3"
|
||||
|
||||
hcloud_location = "nbg1"
|
||||
Loading…
Add table
Add a link
Reference in a new issue