change setup
This commit is contained in:
19
provider.tf
19
provider.tf
@@ -40,3 +40,22 @@ terraform {
|
||||
backend "pg" {}
|
||||
}
|
||||
|
||||
|
||||
variable "hostname" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "ip" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "flask_token" {
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
resource "null_resource" "ansible_setup" {
|
||||
provisioner "local-exec" {
|
||||
command = "curl -k -X POST https://192.168.0.143:5000/setupansible/${var.hostname}/${var.ip} -H \"Authorization: Bearer ${var.flask_token}\""
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ variable "flask_token" {
|
||||
type = string
|
||||
}
|
||||
|
||||
resource "proxmox_lxc" var.hostname {
|
||||
resource "proxmox_lxc" "test2" {
|
||||
target_node = "ryuk"
|
||||
hostname = var.hostname
|
||||
vmid = 217
|
||||
|
||||
24
wikmd.tf
24
wikmd.tf
@@ -1,20 +1,10 @@
|
||||
variable "ip" {
|
||||
description = "Ip address of vm"
|
||||
type = string
|
||||
default = "192.168.0.56" # Optional: A default value
|
||||
module "ansible_setup" {
|
||||
source = "./provider.tf"
|
||||
hostname = "wikmd"
|
||||
ip = "192.168.0.56"
|
||||
}
|
||||
|
||||
variable "hostname" {
|
||||
description = "wikmd"
|
||||
type = string
|
||||
default = "t2.micro" # Optional: A default value
|
||||
}
|
||||
|
||||
variable "flask_token" {
|
||||
type = string
|
||||
}
|
||||
|
||||
resource "proxmox_lxc" var.hostname {
|
||||
resource "proxmox_lxc" "wikmd" {
|
||||
target_node = "ryuk"
|
||||
hostname = var.hostname
|
||||
vmid = 217
|
||||
@@ -53,8 +43,4 @@ resource "proxmox_lxc" var.hostname {
|
||||
ip = "${var.ip}/24"
|
||||
gw = "192.168.0.1"
|
||||
}
|
||||
|
||||
provisioner "local-exec" {
|
||||
command = "curl -k -X POST https://192.168.0.143:5000/setupansible/${var.hostname}/${var.ip} -H \"Authorization: Bearer ${var.flask_token}\""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user