问题描述
使用Test Kitchen,在yaml配置中...在哪里存储存储适用于多个平台和多个套件的全局使用属性的最佳位置?
With Test Kitchen, in the yaml configs... where is the best place to store globally used attributes that apply to multiple platforms and multiple suites?
要使用以我的.kitchen.yml为例:
To use my .kitchen.yml as an example:
---
provisioner:
name: chef_solo
platforms:
- name: centos-6.5
driver:
name: vagrant
- name: amazon
driver:
name: ec2
image_id: ami-ed8e9284
flavor_id: t2.medium
aws_ssh_key_id: <snip>
ssh_key: <snip>
availability_zone: us-east-1a
subnet_id: subnet-<snip>
require_chef_omnibus: true
iam_profile_name: <snip>
ebs_delete_on_termination: true
security_group_ids: sg-<snip>
# area in question (does not work here)
attributes:
teamcity:
server: 'build.example.com'
port: 80
username: 'example'
password: 'example'
# end area in question
suites:
- name: resin4
run_list:
- recipe[example_server::resin4]
- recipe[example_server::deploy_all_artifacts]
- name: deploy
run_list:
- recipe[example_server::deploy_all_artifacts]
- name: default
run_list:
- recipe[example_server::elasticsearch]
- recipe[example_server::resin4]
- recipe[example_server::deploy_all_artifacts]
我知道还有其他厨房文件,例如〜/ kitchen / config.yml和.kitchen .local.yml,但是我一直无法找到将属性应用于所有平台和套件的方法。复制和粘贴属性到平台是最好的方法吗?
I know there are other kitchen files, such as ~/kitchen/config.yml and .kitchen.local.yml but I've been unable to find a away to get attributes to apply to all platforms and suites. Is copy and pasting attributes to platforms the best way?
推荐答案
是否有理由在厨房的Yaml中指定这些属性,而不是 recipe [example_server :: deploy_all_artifacts]
?
Is there a reason to specify these attributes in kitchen's yaml and not recipe[example_server::deploy_all_artifacts]
? If necessary you could set overrides in kitchen.
此外,这篇文章可能会有所帮助:
Also, this post might be helpful: Access Attributes Across Recipes
这篇关于测试厨房,存储凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!