Wait 30secs before running ansible

This commit is contained in:
spengreb 2023-01-23 20:34:02 +01:00
parent 4e98e9c63f
commit a4c5d75976

12
main.tf
View file

@ -16,18 +16,8 @@ resource "aws_instance" "jamulus" {
key_name = "jamulus"
security_groups = [aws_security_group.ssh.name, aws_security_group.jamulus.name, aws_security_group.node-exporter.name] # Add your own IP to this group
provisioner "remote-exec" {
inline = ["sudo apt update", "sudo apt install python3 -y", "echo Done!"]
connection {
type = "ssh"
user = "ubuntu"
host = self.public_ip
private_key = file("${path.module}/jamulus.pem")
}
}
provisioner "local-exec" {
command = "ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u ubuntu -i '${self.public_ip},' --private-key ${"${path.module}/jamulus.pem"} jamulus-install.yml"
command = "sleep 30 && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u ubuntu -i '${self.public_ip},' --private-key ${"${path.module}/jamulus.pem"} jamulus-install.yml"
}
tags = {