Skip to content

Instantly share code, notes, and snippets.

@lgueye
Created October 30, 2018 16:26
Show Gist options
  • Save lgueye/fccb0c5272eab20a033b51b5e5b63ff4 to your computer and use it in GitHub Desktop.
Save lgueye/fccb0c5272eab20a033b51b5e5b63ff4 to your computer and use it in GitHub Desktop.
resource "digitalocean_droplet" "consul_server_01_droplet" {
image = "${var.droplet_image}"
name = "${var.consul_server_role}-01"
region = "${var.primary_datacenter_name}"
size = "${var.droplet_size}"
private_networking = true
ssh_keys = ["${var.ssh_fingerprint}"]
tags = ["${digitalocean_tag.target_env.name}","${digitalocean_tag.consul_server_role.name}"]
}
resource "ansible_host" "consul_server_01_droplet" {
inventory_hostname = "${digitalocean_droplet.consul_server_01_droplet.name}"
groups = ["${var.target_env}","${var.consul_server_role}","${var.primary_datacenter_role}"]
vars {
ansible_host = "${digitalocean_droplet.consul_server_01_droplet.ipv4_address}"
ansible_python_interpreter = "${var.ansible_python_interpreter}"
datacenter_name = "${var.primary_datacenter_name}"
datacenter_role = "${var.primary_datacenter_role}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment