Test Kitchen, store credentials

2019-06-02 10:16发布

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?

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]

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?

1条回答
唯我独甜
2楼-- · 2019-06-02 10:41

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

查看更多
登录 后发表回答