You've already forked ansible-role-common
Added in Terraform provisioner
This commit is contained in:
53
terraform/drone-runners.tf
Normal file
53
terraform/drone-runners.tf
Normal file
@@ -0,0 +1,53 @@
|
||||
variable "drone_instances" {
|
||||
description = "How many runner instances should there be?"
|
||||
default = 3
|
||||
}
|
||||
variable "root_pass" {
|
||||
description = "Root password to set on the node"
|
||||
}
|
||||
|
||||
variable "linode_api_token" {
|
||||
description = "Linode API Token"
|
||||
}
|
||||
|
||||
variable "ssh_pubkey" {
|
||||
description = "SSH key to be allowed access by default"
|
||||
}
|
||||
|
||||
terraform {
|
||||
required_providers {
|
||||
linode = {
|
||||
source = "linode/linode"
|
||||
version = "1.16.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "linode" {
|
||||
token = var.linode_api_token
|
||||
}
|
||||
|
||||
resource "linode_instance" "terraform-drone" {
|
||||
connection {
|
||||
type = "ssh"
|
||||
user = "root"
|
||||
password = var.root_pass
|
||||
host = self.ip_address
|
||||
}
|
||||
|
||||
count = var.drone_instances
|
||||
image = "private/15818922"
|
||||
label = "drone-runner-${count.index + 1}"
|
||||
group = "docker"
|
||||
tags = ["tag_Testing","docker"]
|
||||
region = "ap-southeast"
|
||||
type = "g6-nanode-1"
|
||||
authorized_keys = [ var.ssh_pubkey ]
|
||||
root_pass = var.root_pass
|
||||
|
||||
provisioner "remote-exec" {
|
||||
inline = [
|
||||
"yum upgrade -y && systemctl restart docker",
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user