vRA Windows 机器创建不会 return 主机 name/addr 在移动到 chef provisioner 块之前
vRA Windows machine creation does not return host name/addr before moving to chef provisioner block
在 vRA 中创建 Windows 机器时,Terraform 将在获取新机器的 IP/FQDN 以传递到供应器之前移动到 Chef Provisioner 块。
Terraform v0.11.14
+ provider.vra7 v0.2.0
我已经尝试了所有可以从互联网上获得的东西; loca-exec'ing knife bootstrap,使用 depends_on 属性,设置睡眠定时器,似乎没有任何效果。
resource "vra7_deployment" "terraform-1" {
count = "${var.server_count}"
description = "deployment via terraform"
reasons = "because it's awesome"
catalog_item_name = "${var.vra_cat_item_name}"
wait_timeout = "1800"
provisioner "chef" {
# This is for chef_server to talk to the node
connection {
type = "winrm"
user = "${var.KT_USER}"
password = "${var.KT_PASS}"
insecure = true
}
# This is for TF to talk to the chef_server
server_url = "${var.chef_server_url}"
node_name = "terraform-chef-test"
run_list = [ ]
user_name = "${var.chef_user_name}"
user_key = "${file(var.chef_user_pem)}"
recreate_client = true
fetch_chef_certificates = true
environment = "_default"
ssl_verify_mode = false
version = "12"
}
}
错误:
vra7_deployment.terraform-1: Still creating... (21m20s elapsed)
vra7_deployment.terraform-1 (chef): Connecting to remote host via WinRM...
vra7_deployment.terraform-1 (chef): Host:
vra7_deployment.terraform-1 (chef): Port: 5985
vra7_deployment.terraform-1 (chef): User: engineering
vra7_deployment.terraform-1 (chef): Password: true
vra7_deployment.terraform-1 (chef): HTTPS: false
vra7_deployment.terraform-1 (chef): Insecure: true
vra7_deployment.terraform-1 (chef): NTLM: false
vra7_deployment.terraform-1 (chef): CACert: false
* vra7_deployment.terraform-1: interrupted - last error: unknown error Post http://:5985/wsman: dial tcp :5985: connectex: No connection could be made because the target machine actively refused it.
var.chef_server_url
是地形变量,不是 vra7_deployment.terraform-1
.
的输出
如果 var.chef_server_url
未设置并传递给无值的配置器,则配置器连接将不起作用
我明白了。关键是了解我的 vRA 实例已设置,以便调用 VM vSphere_Machine_1
。它就在 UI 中,如 Component Name
.
肯定有一些思维上的飞跃,而且我确定我必须看过所有其他示例并犯下我犯过的所有错误,以便我的大脑在那一刻将它们放在一起。无论采用何种机制,此代码现在都有效:
# in resource block
resource_configuration {
vSphere_Machine_1.name = ""
}
...
# in provisioner block
connection {
host = "${self.resource_configuration.vSphere_Machine_1.name}"
....
}
当然,现在是下一堵砖墙……但我想通了。我打算将它转发给社区。
对于其他提出相同问题的人,您正在寻找 vRa 项目的机器列表中的组件名称。
在 vRA 中创建 Windows 机器时,Terraform 将在获取新机器的 IP/FQDN 以传递到供应器之前移动到 Chef Provisioner 块。
Terraform v0.11.14 + provider.vra7 v0.2.0
我已经尝试了所有可以从互联网上获得的东西; loca-exec'ing knife bootstrap,使用 depends_on 属性,设置睡眠定时器,似乎没有任何效果。
resource "vra7_deployment" "terraform-1" {
count = "${var.server_count}"
description = "deployment via terraform"
reasons = "because it's awesome"
catalog_item_name = "${var.vra_cat_item_name}"
wait_timeout = "1800"
provisioner "chef" {
# This is for chef_server to talk to the node
connection {
type = "winrm"
user = "${var.KT_USER}"
password = "${var.KT_PASS}"
insecure = true
}
# This is for TF to talk to the chef_server
server_url = "${var.chef_server_url}"
node_name = "terraform-chef-test"
run_list = [ ]
user_name = "${var.chef_user_name}"
user_key = "${file(var.chef_user_pem)}"
recreate_client = true
fetch_chef_certificates = true
environment = "_default"
ssl_verify_mode = false
version = "12"
}
}
错误:
vra7_deployment.terraform-1: Still creating... (21m20s elapsed)
vra7_deployment.terraform-1 (chef): Connecting to remote host via WinRM...
vra7_deployment.terraform-1 (chef): Host:
vra7_deployment.terraform-1 (chef): Port: 5985
vra7_deployment.terraform-1 (chef): User: engineering
vra7_deployment.terraform-1 (chef): Password: true
vra7_deployment.terraform-1 (chef): HTTPS: false
vra7_deployment.terraform-1 (chef): Insecure: true
vra7_deployment.terraform-1 (chef): NTLM: false
vra7_deployment.terraform-1 (chef): CACert: false
* vra7_deployment.terraform-1: interrupted - last error: unknown error Post http://:5985/wsman: dial tcp :5985: connectex: No connection could be made because the target machine actively refused it.
var.chef_server_url
是地形变量,不是 vra7_deployment.terraform-1
.
如果 var.chef_server_url
未设置并传递给无值的配置器,则配置器连接将不起作用
我明白了。关键是了解我的 vRA 实例已设置,以便调用 VM vSphere_Machine_1
。它就在 UI 中,如 Component Name
.
肯定有一些思维上的飞跃,而且我确定我必须看过所有其他示例并犯下我犯过的所有错误,以便我的大脑在那一刻将它们放在一起。无论采用何种机制,此代码现在都有效:
# in resource block
resource_configuration {
vSphere_Machine_1.name = ""
}
...
# in provisioner block
connection {
host = "${self.resource_configuration.vSphere_Machine_1.name}"
....
}
当然,现在是下一堵砖墙……但我想通了。我打算将它转发给社区。
对于其他提出相同问题的人,您正在寻找 vRa 项目的机器列表中的组件名称。