【发布时间】:2017-05-22 18:25:26
【问题描述】:
我使用此配置是为了使用厨师客户端和流浪者来配置我的客人:
config.vm.provision "chef_client" do |chef|
chef.add_recipe 'living-development'
chef.chef_server_url = 'https://api.chef.io/organizations/my-organization'
chef.validation_key_path = 'cert.pem'
chef.validation_client_name = 'validation'
chef.version = '12.19.36'
end
这个配置在使用 chef 和 vagrant 时运行良好。不过,我需要使用 terraform 配置我的机器。我不太清楚如何使用"terraform+chef" 设置以上"vagrant+chef" 配置。
到现在为止,我一直在得到这个:
# Create a new Web Droplet in the nyc2 region
resource "digitalocean_droplet" "web" {
image = "ubuntu-14-04-x64"
name = "web-1"
region = "fra1"
size = "512mb"
ssh_keys = ["${digitalocean_ssh_key.default.id}"]
volume_ids = ["${digitalocean_volume.foobar.id}"]
provisioner "chef" {
server_url = "https://api.chef.io/organizations/my-organization"
user_name = "living"
user_key = "./living.pem"
node_name = "living"
run_list = [ "cookbook::living-development" ]
version = "12.19.36"
}
}
执行将我打印出来:
digitalocean_droplet.web (chef): Connecting to remote host via SSH...
digitalocean_droplet.web (chef): Host: 139.59.148.167
digitalocean_droplet.web (chef): User: root
digitalocean_droplet.web (chef): Password: false
digitalocean_droplet.web (chef): Private key: false
digitalocean_droplet.web (chef): SSH Agent: false
digitalocean_droplet.web: Still creating... (1m0s elapsed)
digitalocean_droplet.web (chef): Connecting to remote host via SSH...
digitalocean_droplet.web (chef): Host: 139.59.148.167
digitalocean_droplet.web (chef): User: root
digitalocean_droplet.web (chef): Password: false
digitalocean_droplet.web (chef): Private key: false
digitalocean_droplet.web (chef): SSH Agent: false
digitalocean_droplet.web (chef): Connecting to remote host via SSH...
digitalocean_droplet.web (chef): Host: 139.59.148.167
digitalocean_droplet.web (chef): User: root
digitalocean_droplet.web (chef): Password: false
digitalocean_droplet.web (chef): Private key: false
digitalocean_droplet.web (chef): SSH Agent: false
digitalocean_droplet.web (chef): Connecting to remote host via SSH...
digitalocean_droplet.web (chef): Host: 139.59.148.167
digitalocean_droplet.web (chef): User: root
digitalocean_droplet.web (chef): Password: false
digitalocean_droplet.web (chef): Private key: false
digitalocean_droplet.web (chef): SSH Agent: false
digitalocean_droplet.web: Still creating... (1m10s elapsed)
digitalocean_droplet.web (chef): Connecting to remote host via SSH...
...
不知道是什么意思……
厨师想要得到什么?
我做错了吗?
【问题讨论】:
-
它正在尝试以 root 用户身份使用 ssh 连接到您的 droplet,但 ubuntu 默认禁用以 root 身份远程登录
-
我完全不明白 Vagrant 是如何参与其中的。
标签: chef-infra terraform