4

I have several different servers used for different purposes. Everyone use mysql, but it should be configured a little bit different. => Different users, different databases.

I have a cookbook that installes mysql.

The question is, where should I put the scripts that create databases and users for mysql?

Sould it be:

  1. One script for every server(role) inside mysql cookbook? (This way different configs for 1 server will be in different cookbooks)
  2. Create a cookbook for every role, where I concatenate all the special configurations concerning this role. (This way different configs for 1 server will be in 1 particular place, but we will have 1 additional cookbook)

I personally think the #1 is better, as we join the different cookbooks under I role anyway.

Edit

It does not concern only databases. For example, I have some applications that require tomcats/jetties/other containers to be installed and configured differently (different ports, different modules enabled). Where different versions of settings.xml/jetty.xml etc. should be stored? In cookbook that

  1. installs tomcat or
  2. that installs other application, that requires tomcat?
4

2 に答える 2

5

データベースとデータベースユーザーを管理するためのLWRPを提供するOpscodeデータベースクックブックを含めることをお勧めします。

次に、データベースとデータバッグにLWRPを活用する一般的なクックブックを1つ作成することをお勧めします。データバッグは構成情報を保持し、サーバーごとの構成の違いを分離します。

これにより、各サーバー(ユーザー、データベースなど)のデータを定義し、データを取得して使用できる1つのクックブックを作成できます。

また、Chefサーバーに暗号化された形式でパスワードを保存できる暗号化されたデータバッグを確認してください。

于 2012-04-24T13:12:46.710 に答える
0

This problem seems to be screaming out for you to use an environment and then have different data bag entries based on environment.

I would place these servers in the appropriate environment, matching the settings they have.

Alternately, the proposal you have around roles also makes sense.

于 2012-05-11T17:56:20.727 に答える