Running initdb
==============

TPAは、最初に\ ``postgres_data_dir``
が存在しない場合は作成し、正しい所有権、権限、およびSELinuxコンテキストがあることを確認します。次に、ディレクトリに\ ``VERSION``
ファイルがまだ含まれていない限り、 ``initdb``
を実行して\ ``postgres_data_dir`` を初期化します。

:ref:`pre-initdb hook <TPA hooks>` を使用できます

``postgres_data_dir`` が作成され、\ ``initdb``
が実行される前にタスクを実行します。フックが\ ``postgres_data_dir``
を初期化すると、TPAは\ ``VERSION`` ファイルを見つけ、 ``initdb``
自分自身を実行する必要がないことを認識します。

オプションで\ ``postgres_initdb_opts`` を\ ``initdb``
に渡すオプションのリストに設定できます。

.. code:: yaml

   cluster_vars:
     postgres_locale: de_DE.UTF-8
     postgres_initdb_opts:
     - --data-checksums

常に\ ``--data-checksums``
オプションデフォルトで含まれるを含めることをお勧めします。

TPAは、 ``initdb`` の実行時に、環境に\ ``TZ=UTC`` を設定し、\ ``LC_ALL``
を指定した\ ``postgres_locale`` に設定します。

別の構成ディレクトリ
--------------------

デフォルトでは、\ ``postgres_conf_dir`` は\ ``postgres_data_dir``
と等しく、Postgres構成ファイルpostgresql.conf、pg_ident.conf、pg_hba.conf、およびconf.dのインクルードファイルはデータディレクトリ内に作成されます。
``postgres_conf_dir`` を変更すると、TPAは\ ``initdb``
を実行した後、生成された構成ファイルを新しい場所に移動します。
