Skip to content

Instantly share code, notes, and snippets.

@maraca
Last active August 29, 2015 14:03
Show Gist options
  • Save maraca/8d06e88f713942ab5ac1 to your computer and use it in GitHub Desktop.
Save maraca/8d06e88f713942ab5ac1 to your computer and use it in GitHub Desktop.
kitchen-ci search nodes.
---
driver:
name: vagrant
provisioner:
name: chef_zero
platforms:
- name: ubuntu-12.04
suites:
- name: postgres_metrics
run_list:
- recipe[watcher::postgres_metrics]

When using kitchen-ci with chef-zero you can search for nodes by creating a fake inventory.
Drop a file in test/integration/nodes and kitchen will be able to query the json files using the search API.

This becomes really handy if you need to query attributes like ipaddress or FQDN

[{"name":"postgres-primary","chef_environment":"_default","json_class":"Chef::Node","automatic":{"ipaddress":"10.0.0.15"},"normal":{},"chef_type":"node","default":{},"override":{},"run_list":["role[postgres-primary]"]},{"name":"postgres-metrics-ubuntu-1204","chef_environment":"_default","json_class":"Chef::Node","automatic":{},"normal":{},"chef_type":"node","default":{},"override":{},"run_list":[]}]       
{
"id": "postgres-primary",
"run_list": ["role[postgres-primary]"],
"automatic": {
"ipaddress": "10.0.0.15"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment