Run local exec after digitalocean droplet

8 views
Skip to first unread message

Julian Zielke

unread,
Oct 15, 2019, 5:09:42 AM10/15/19
to Vagrant
Hi,

I'm currently using Terragrunt in combination with Terraform to deploy digitalocean droplets.

What I'm planning is to use local exec in order to run Ansbile on the deployed host(s) afterwards. So I need to access the list of hosts somehow but I always run into an error
saying that the variable xyz is not (yet) declared.

Here's an Example I've tried:

resource "digitalocean_droplet" "instance" {
 image             = "${var.host_image}"
 name              = "${var.host_name}"
 region            = "fra1"
 size              = "${var.host_sizing}"
 backups           = "${var.useBackups}"
 tags              = "${split(",", replace(var.host_tags, " ", ""))}"
 ssh_keys          = ["${digitalocean_ssh_key.default.fingerprint}"]
 provisioner "remote-exec" {
   inline = ["echo"]

    connection {
     host        = "${data.digitalocean_droplet.instance.ipv4_address}"
     type        = "ssh"
     user        = "root"
     private_key = "${file(var.public_key)}"
   }
 }
}

Any chance to accomplish my goal?

Alvaro Miranda Aguilera

unread,
Nov 25, 2019, 4:27:02 PM11/25/19
to vagra...@googlegroups.com
hello

sorry for the late reply

this is the vagrant mailing list

do you have a vagrant question?

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/65cec1b4-203f-4f0d-bb96-5c9e8e5e137e%40googlegroups.com.


--
Alvaro

Reply all
Reply to author
Forward
0 new messages