我正在尝试将 chef-client 配置为将日志输出到测试厨房运行中的文件,但我的配置.kitchen.yml
似乎没有反映在client.rb
准备好的和注入到测试节点中。
我在 virtualbox 上使用 ChefDK 0.3.6、chef_zero 配置器和 vagrant 驱动程序。
.kitchen.yml
我的文件的摘录:
...
provisioner:
name: chef_zero
...
- name: install-only
run_list:
- recipe[my_cookbook::test_recipe]
attributes:
chef_client:
config:
log_location: "/var/log/chef/chef-client.log"
...
另一个摘录,这是从以下输出中提取的kitchen diagnose
:
...
provisioner:
attributes:
chef_client:
config:
log_location: "/var/log/chef/chef-client.log"
chef_client_path: "/opt/chef/bin/chef-client"
chef_omnibus_install_options:
chef_omnibus_root: "/opt/chef"
...
最后,/tmp/kitchen/client.rb
测试节点上的内容:
[root@TRSTWPRTSTAPV99 log]# cat /tmp/kitchen/client.rb
node_name "install-only-rhel65-x86-64"
checksum_path "/tmp/kitchen/checksums"
file_cache_path "/tmp/kitchen/cache"
file_backup_path "/tmp/kitchen/backup"
cookbook_path ["/tmp/kitchen/cookbooks", "/tmp/kitchen/site-cookbooks"]
data_bag_path "/tmp/kitchen/data_bags"
environment_path "/tmp/kitchen/environments"
node_path "/tmp/kitchen/nodes"
role_path "/tmp/kitchen/roles"
client_path "/tmp/kitchen/clients"
user_path "/tmp/kitchen/users"
validation_key "/tmp/kitchen/validation.pem"
client_key "/tmp/kitchen/client.pem"
chef_server_url "http://127.0.0.1:8889"
encrypted_data_bag_secret "/tmp/kitchen/encrypted_data_bag_secret"
如您所见,预期的log_location
条目未包含在 中client.rb
,我猜这是在指定路径中未创建日志文件的原因。
您能否帮助我了解如何通过厨房的 chef-client 正确启用对文件的日志记录?
目前使用的参考文献:
client.rb
参考:https ://docs.chef.io/config_rb_client.html- 厨师客户特定设置
.kitchen.yml
:https ://docs.chef.io/config_yml_kitchen.html#chef-client-specific-settings