我通过以下方式创建了我的 kitchen.yml
:
---
driver:
name: vagrant
customize:
memory: 2048
driver_config:
require_chef_omnibus: true
use_vagrant_berkshelf_plugin: true
provisioner:
name: chef_zero
chef_omnibus_url: http://box-url/install.sh
platforms:
- name: prod.abc.com
driver:
box_url: http://abc.box
run_list:
- role[new_role]
suites:
- name: default
在上面的 kitchen.yml
中,我将机器的主机名设置为 default-prodabccom
。但是,我希望主机名是 prod.abc.com
我应该在 kitchen.yml
中进行哪些更改才能获得正确的名称?
最佳答案
访客系统的主机名
为了定义 VM 内运行的操作系统的主机名(参见 /etc/hostname
),请使用 vm_hostname
kitchen-vagrant 驱动程序的选项:
platforms:
- name: prod.abc.com
driver_config:
vm_hostname: prod.abc.com
测试厨房套件/平台的名称
重命名 Converging <default-prodabccom>
中显示的套件平台组合,你只能玩name
的suite
和platform
,即得到production-abccom
。这个名字是computed here in test-kitchen并且,例如,所有点都被剥离,这不能简单地更改。
尽管如此,如果我理解正确的话,你想更改这个名称:这对我来说没什么意义。不要改变它。
VirtualBox 中虚拟机的名称
VM 的名称(例如 kitchen-default-prodabcom_..default_1234..
)源自 here in kitchen-vagrant并且不能轻易改变。
关于vagrant - 如何更改 Chef kitchen.yml 中的框名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38682471/