Created
July 12, 2020 16:12
-
-
Save taragurung/07e1645b9a8ef5832095c642e32ce00a to your computer and use it in GitHub Desktop.
Terraform connection and provisioner to install python on droplet created
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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