I’m trying to put together a .kitchen.yml file that combines the use of
both vagrant and ec2. Is that possible? Can’t find any concrete examples
and the documentation.
Doug
I’m trying to put together a .kitchen.yml file that combines the use of
both vagrant and ec2. Is that possible? Can’t find any concrete examples
and the documentation.
Doug
Doug-
This is definitely possible. The driver
section at the top of your .kitchen.yml is basically a global driver section, but each platform
item can have its own driver configuration.
Here is an abbreviated example:
platforms:
- name: centos-7.1-vagrant
driver:
name: vagrant
box: opscode-centos-7.1
- name: centos-7.1-ec2
driver:
name: ec2
image_id: ami-12345678
When you run kitchen list
, you can see that different drivers are chosen for each instance:
Instance Driver Provisioner Verifier Transport Last Action
default-centos-71-vagrant Vagrant ChefZero Busser Ssh <Not Created>
default-centos-71-ec2 Ec2 ChefZero Busser Ssh <Not Created>
Hope that helps.
~Adam
Thanks Adam.
How are the Instance names populated from the kitchen.yml file? I have
something like the following. Note I put a ‘x’ at the front of the suite
name, thinking it was used to construct the instance names. However, a
kitchen list shows ‘default-default-ec2’ and ‘default-default-vagrant’.
I don’t see a specific example in your post, but instance names are a concatenation of <suite_name>-<platform_name>
.
This .kitchen.yml:
platforms:
- name: alpha
driver:
name: vagrant
box: opscode-centos-7.1
- name: bravo
driver:
name: ec2
image_id: ami-12345678
suites:
- name: one
run_list:
- recipe[test::one]
- name: two
run_list:
- recipe[test::two]
… produces this kitchen list
output:
Instance Driver Provisioner Verifier Transport Last Action
one-alpha Vagrant ChefZero Busser Ssh <Not Created>
one-bravo Ec2 ChefZero Busser Ssh <Not Created>
two-alpha Vagrant ChefZero Busser Ssh <Not Created>
two-bravo Ec2 ChefZero Busser Ssh <Not Created>
~Adam
Adam,
That’s weird. My code was stripped out. Anyway, I’m also trying to set the
roles and environments paths, and also to set the chef environment. It
seems like there’s no good docs on this. One place says one thing, and
another source says something else. I don’t trust the chef docs on test
kitchen or the github page. It’s all quite frustrating really. It’s a shame
there’s no definitive source.
Doug.