How to verify bootstrap status with in the node itself

Dear All,
Due to network constraints we are running bootstrap command from the node itself, which is registering the node on Chef server. If we automate this, what are all the options to verify whether the node has been properly bootstrapped or not? Is there any specific command or API to find it from the same node?

You could just run:

  • chef-client

That won’t have anything yet in the run list from a “self bootstrap” operation. But it will communicate with the server, which you can observe. Or you can run some nominal, known safe cookbook with:

  • chef-client -o “recipe[safe]”

In fact, when originally setting up hosts, I usually have some original set of configuration settings that get run once to do original system configs, setups that are not part of the daily re-runs of Chef. and only get run on a bootstrap or perhaps part of monthly maintenance operations. That especially includes things like “yum update”. or partitioning tools.

Yes, I know that there is an ideal of “Chef has a defined state!!! You need to enforce that by running the complete chef run every time, or your definition is incomplete!!”. But I’m afraid there are steps associated with bootstrap that you often do not want to run every time. because that “defined state” can be tricky to safely do on a running system. “yum update” is one of those, becuuse of cookbooks like the tomcat and mysql cookbooks that flush the default built RPM installation files and try, awkwardly, to replace them with instance named damion configuration files, and for which RPM updates can leave the state in a screwed up config that requires a second chef run to clear up.

Been there, done thatt. It’s why you don’t include “yum update” as part of your regularly scheduled chef runs but do it only during maintenance windows.

We are running the bootstrap (which is a script) from the node, what we need to register with chef-server. Once that script is completed, we need to verify that, whether the bootstrap has been done properly using some script. To achieve that, what are all the options available? Since this is not a workstation, we can not use knife command. So do there any chef API which we shall use and test the bootstrap status? Or any other best practice in this kind of requirement?