【发布时间】:2021-03-30 08:45:12
【问题描述】:
我正在关注本教程https://www.digitalocean.com/community/tutorials/how-to-use-ansible-with-terraform-for-configuration-management,学习 Terraform 和 Ansible。
当我执行terraform apply时,它会抛出一个错误:
digitalocean_droplet.web[2]: Provisioning with 'remote-exec'...
Error: Failed to parse ssh private key: ssh: this private key is passphrase protected
Error: Error creating droplet: POST https://api.digitalocean.com/v2/droplets: 422 Failed to resolve VPC
on droplets.tf line 1, in resource "digitalocean_droplet" "web":
1: resource "digitalocean_droplet" "web" {
这是代码:
provisioner "remote-exec" {
inline = ["sudo apt update", "sudo apt install python3 -y", "echo DONE!"]
connection {
host = self.ipv4_address
type = "ssh"
user = "root"
private_key = file(var.pvt_key)
}
}
我机器上的 SSH 私钥 (~/.ssh/id_rsa) 受密码保护。如何使用它?
【问题讨论】:
标签: ssh ansible terraform devops digital-ocean