I have two recipes:
- Configures my home directory with things like my .bashrc, run on almost every machine I use
- Mounts an EBS volume containing my home directory. This only gets used by a single EC2 instance at a time, but lets me easily migrate to a new instance
In the case of this EC2 instance when it first boots up, I need recipe #2 to be executed before recipe #1 or the volume won’t be mounted yet. How can I ensure that this order of execution will be explicitly forced?
Chef always executes recipes in the order you specify them. It will not arbitrarily reorder things. So if you want one recipe to be run before another, just load them in that order (e.g. In the
run_list)To further enforce this (at the expense of additional coupling between your recipes) you can also use
include_recipeat he beginning of the second recipe to load the first one.