I have the following situation that I would like some tips on. I’m developing some cookbooks that involve configuring a software stack that involves more than 1 node at a time. We have our test kitchen configuration pointing at AWS, and we can spin up test instances on demand in AWS. Here’s my scenario:
- I spin up test kitchen instance 1 with recipe A
- I sping up test kitchen instance 2 with recipe B
- Instance 2 needs information in recipe B about instance 1, specifically its IP address.
For now, I’ve set the IP address of node 1 as an attribute that I manually enter once kitchen has created my instances, by looking at the generated YAML file in the .kitchen folder. Ideally, I’d love to be able to automatically set this value somehow.
I’ve been searching online and found various examples of using Chef search to identify the target node and get information that way, but this doesn’t seem to work with test kitchen instances, only deployed nodes.The only other thing that occurred to me was to figure out how to parse the kitchen YAML file somehow, but this file doesn’t seem to be deployed to the servers by test kitchen.
Any ideas are highly appreciated. Thanks!