O'Reilly logo

Configuration Management with Chef-Solo by Naveed ur Rahman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data bags

A data bag is a global variable that is stored in JSON and can be accessed by Chef. It is indexed for searching and loaded by chef-client while executing the recipe.

We can use data bags directly in a JSON file or create them using Knife Solo. First, we will use a simpler approach, that is, updating the password with a JSON file.

Before we proceed further, we will create a JSON file under the same folder of Vagrantfile and use this file to run recipes. The benefit of this approach is that Chef-Solo requires a JSON file to execute recipes, and we can test our JSON file with Vagrant. The steps are as follows:

  1. Create your file in the same folder where Vagrantfile exists:
    # wpblog.json { "wpblog":{ "db_password": "dbpass1234" }, "run_list": ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required