我想将厨房集成到现有的木偶存储库中进行测试。我通过Gemfile添加了所需的宝石。我的kitchen.yml文件看起来像这样:
---
driver:
vagrantfile_erb: Vagrantfile.erb
provision: true
name: vagrant
provisioner:
name: puppet_apply
require_chef_for_busser: false
manifests_path: manifests
manifest: site.pp
modules_path: modules
puppet_environment_config_path: environment.conf
puppet_environment: kitchen_vagrant_puppet
files_path: site/profile/files
hiera_data_path: hieradata # Path to hiera data on host server
verifier:
name: inspec
platforms:
- name: puppetmaster-centos-7
driver_plugin: vagrant
driver_config:
box: bento/centos-7.3
suites:
- name: default
manifest: site.pp
木偶回购的目录结构为
├── data
│ └── common.yaml
├── Gemfile
├── Puppetfile
├── Vagrantfile.erb
├── kitchen.yml
├── environment.conf
├── hiera.yaml
├── modules
│ └── ...
├── hieradata
│ └── hiera.yaml
├── manifests
│ └── site.pp
├── site
│ ├── profile
│ │ ├── files
│ │ └── manifests
│ │ ├── README.md
│ │ └── appliance
│ │ └── base.pp
│ └── role
│ └── manifests
│ ├── README.md
│ └── role1
│ └── appliance.pp
└── setup-kitchen-environment.sh
puppet-apply
预配者负责将模块,清单和hiera.yaml文件带到厨房无所事事的机器上。
我找不到使用site
预配器将目录data
和puppet-apply
带到厨房机器的方法。因此,我将仓库安装为vagrant中的共享文件夹,并通过vagrant up
命令中的配置脚本将其复制。
配置脚本为:
mkdir -p /tmp/kitchen/data
cp -a /vagrant/data/* /tmp/kitchen/data
cp -a /vagrant/site /tmp/kitchen/
chown -R vagrant:vagrant /tmp/kitchen/
hiera.yaml文件为:
---
version: 5
defaults:
datadir: "data"
hierarchy:
- name: 'Yaml backend'
data_hash: yaml_data
paths:
- 'common.yaml'%
当我运行厨房收敛时,它失败并显示以下错误:
Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::role::role1::appliance for default-puppetmaster-centos-7.vagrantup.com (file: /tmp/kitchen/manifests/site.pp, line: 9, column: 3) on node default-puppetmaster-centos-7.vagrantup.com
manifests / site.pp如下:
File { backup => false }
if $::custom_facts['appliance_type'] == 'Delivery' {
include role::role0::app
}
if $::custom_facts['appliance_type'] == 'Appliance' {
include role::role1::appliance **// line where error is occuring**
}
node default {
}
当我检查无业游民的机器时,/tmp/kitchen
的结构如下:
.
|-- data
| |-- common.yaml
|-- environment
| |-- environment.conf
| `-- hiera.yaml
|-- files
| `-- cdn
|-- hiera
| `-- hiera.yaml
|-- hiera.global.yaml
|-- manifests
| `-- site.pp
|-- modules
|
`-- site
|-- profile
| |-- files
| `-- manifests
| |-- appliance
| | |-- base.pp
`-- role
`-- manifests
|-- README.md
`-- role1
`-- appliance.pp
应用的木偶命令:
sudo -E /opt/puppetlabs/bin/puppet apply /tmp/kitchen/manifests/site.pp --modulepath=/tmp/kitchen/modules --fileserverconfig=/tmp/kitchen/fileserver.conf --environment=kitchen_vagrant_puppet --environmentpath=/etc/puppetlabs/code/environments --hiera_config=/tmp/kitchen/hiera.global.yaml
我有2个问题:
1. Is there a way to get the `site` and `data` directories using `puppet-apply` provisioner to the vagrant machine?
2. I cant figure out why puppet cannot find the class. Is the directory structure wrong? I am able to execute the same repository with the same structure without kitchen integration.