vagrant - 如何更改 Chef kitchen.yml 中的框名称?

标签 vagrant chef-infra test-kitchen

我通过以下方式创建了我的 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> 中显示的套件平台组合,你只能玩namesuiteplatform ,即得到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/

相关文章:

ruby - 启动 Knife 配置命令时出错

python - 我们如何使用 Chef 连接基于集群的软件?

vagrant,安装 chef/centos-6.6

Vagrant:不要将主机名映射到/etc/hosts 中的环回地址

python - 以编程方式在 Vagrant 中获取 vm 的 IP 地址

hadoop - 如何在Test Kitchen Chef中使用群集节点我需要与 Chef 一起在测试厨房中安装hadoop群集进行测试

ruby - 测试厨房中的 ulimit

virtual-machine - PHPStorm + XDebug + Vagrant

chef-infra - 当没有对 erb 模板进行任何更改时,Chef 会不断重新启动服务

ruby - 无法从加载路径 : Kitchen cannot find kitchen-vagrant's plugin 加载 'vagrant' 驱动程序