I’m trying to provision a server with a cookbook that uses the mysql_database resource from the database cookbook. This cookbook depends on the mysql cookbook, which requires building due to references to native code (e.g. libmysqlclient). In trying to bootstrap a brand new node, which doesn’t have gcc (and other build-essential components), I cannot get past the error:
Error executing action
install on resource ‘chef_gem[mysql]’
My cookbook has a “depends” statement for the “database” cookbook. And that cookbook has a dependency on “mysql”. Prior to executing any of the recipes in any of the defined cookbook, chef-client tries to compile the cookbooks it knows it needs. It can’t build the “mysql” cookbook because gcc is not yet installed. While I’ve added “recipe[build-essential]” to the head of my run_list for the role, chef-client never gets this far, as it wants to compile all cookbooks in the dependency list prior to executing any of the recipes in the run list.
How do I get around this? I want to bootstrap a node that doesn’t have gcc installed (yet). How do I get chef-client to install the build-essential package BEFORE compiling cookbooks?