- fix provisioners - move inline to scripts - fix scripts
This commit is contained in:
24
instances.tf
24
instances.tf
@@ -7,20 +7,18 @@ resource "google_compute_instance" "agent" {
|
||||
zone = "${var.zone_instance}"
|
||||
tags = ["${var.zabbix_tag}"]
|
||||
|
||||
# add image disk
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = var.disk_image
|
||||
}
|
||||
}
|
||||
|
||||
# add network
|
||||
network_interface {
|
||||
network = "default"
|
||||
access_config {
|
||||
}
|
||||
}
|
||||
# ssh_key
|
||||
|
||||
metadata = {
|
||||
sshKeys = "${var.default_user}:${file("~/.ssh/id_rsa.pub")}"
|
||||
}
|
||||
@@ -32,23 +30,17 @@ resource "google_compute_instance" "agent" {
|
||||
private_key = "${file("~/.ssh/id_rsa")}"
|
||||
}
|
||||
|
||||
provisioner "remote-exec" {
|
||||
inline = ["${file("scripts/setupagent.sh")}"]
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
source = "scripts/agents/zabbix_agentd.conf"
|
||||
destination = "~/zabbix_agentd.conf"
|
||||
}
|
||||
|
||||
provisioner "remote-exec" {
|
||||
inline = [
|
||||
"sudo apt update",
|
||||
"sudo apt install nginx -y",
|
||||
"sudo echo ${self.name} >> /var/www/html/index.nginx-debian.html",
|
||||
"sudo systemctl enable nginx && sudo systemctl start nginx",
|
||||
"sudo cp ~/zabbix_agentd.conf /etc/zabbix/",
|
||||
"sudo service zabbix-agent restart"
|
||||
]
|
||||
provisioner "file" {
|
||||
source = "scripts/setupagent.sh"
|
||||
destination = "~/setupagent.sh"
|
||||
}
|
||||
|
||||
# provisioner "remote-exec" {
|
||||
# inline = ["${file("scripts/setupagent.sh")}"]
|
||||
# }
|
||||
}
|
||||
|
Reference in New Issue
Block a user