Skip to content

Instantly share code, notes, and snippets.

@taragurung
Created July 12, 2020 16:12
Show Gist options
  • Save taragurung/07e1645b9a8ef5832095c642e32ce00a to your computer and use it in GitHub Desktop.
Save taragurung/07e1645b9a8ef5832095c642e32ce00a to your computer and use it in GitHub Desktop.
Terraform connection and provisioner to install python on droplet created
#connecting to server provisoned for adding python
connection {
host = self.ipv4_address #will use the ip address of the droplet created
user = "root"
type = "ssh"
private_key = file("~/.ssh/id_rsa") #will use the private key of the hosts allowed to connect to droplet created
timeout = "2m"
}
#we need python for ansible to run
provisioner "remote-exec" {
inline = [
"export PATH=$PATH:/usr/bin",
# install python
"sudo apt-get update",
"sudo apt-get -y install python"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment